Ich habe folgendes problem mit meinem Jailsys... (selfmade)
A. Ich blicke nicht mehr durch
B. Es Funktioniert nicht... also Jeffry: `s Schlimmster Abtraum
Was ich geplant Hatte:
- SQLite Jailsystem
- Bei Spielertod durch Polizist kein Spawn ins Jail
- Automatische Jailtime (Absicherung gegen mögliches Abuse)
Was ich geschafft habe...
- Einen Haufen Stocks
- Einen viel größeren haufen mit Problemen
stock WantedLoad(playerid)
{
new query[128];
new name[128];
GetPlayerName(playerid,query,MAX_PLAYER_NAME);
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(query,128,"SELECT `WANTED` FROM `USERS` WHERE `Name` = '%s'",query);
new DBResult:result = db_query(Database, query);
new str[5];
if(db_num_rows(result)) db_get_field(result, 0, str, sizeof(str));
WantedLevel[playerid] = strval(str);
printf("playerid: %d / Wanted: %d / name: %s", playerid, WantedLevel[playerid], name);
return 1;
}
stock Jail(playerid) //Polizei Knast Laden
{
new query[128];
new name[128];
GetPlayerName(playerid,query,MAX_PLAYER_NAME);
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(query,128,"SELECT `JAILED` FROM `USERS` WHERE `Name` = '%s'",query);
new DBResult:result = db_query(Database, query);
new str[5];
if(db_num_rows(result)) db_get_field(result, 0, str, sizeof(str));
Jailed[playerid] = strval(str);
printf("playerid: %d / JAILED: %d / name: %s", playerid, Jailed[playerid], name);
if (Jailed[playerid] == 1)
{
new Random = random(sizeof(JailSpawns));
SetPlayerPos(playerid, JailSpawns[Random][0], JailSpawns[Random][1], JailSpawns[Random][2]);
SetPlayerFacingAngle(playerid, JailSpawns[Random][3]);
LoadJailTime(playerid);
}
else if (Jailed[playerid] == 0)
{
//TogglePlayerSpectating(playerid,0);
SetPlayerVirtualWorld(playerid,0);
SetPlayerPos(playerid,-1952.1089,112.4961,26.2813);
}
return 1;
}
stock AJail(playerid)
{
return 1;
}
stock SetJailTime(playerid) //Polizei Knast Setzen
{
new query[128];
new jailtime = (WantedLevel[playerid] * 150);
GetPlayerName(playerid,query,MAX_PLAYER_NAME);
format(query,128,"UPDATE `USERS` SET `JAILTIME` = '%d' WHERE `Name` = '%s'",jailtime, query);
db_query(Database,query);
return 1;
}
stock JailTimer(playerid) //Polizei Knast Timer
{
SetPlayerVirtualWorld(playerid,0);
SetPlayerPos(playerid,-1952.1089,112.4961,26.2813);
return 1;
}
stock UnJailed(playerid)
{
/* ===== Hier wird "Jailed" auf 0 gesetzt ===== */
format(query,128,"UPDATE `USERS` SET `JAILED` = '0' WHERE `Name` = '%s'", query);
db_query(Database,query);
return 1;
}
stock UnJailTime(playerid)
{
/* ===== Hier wird "Jailtime" auf 0 gesetzt ===== */
format(query,128,"UPDATE `USERS` SET `JAILTIME` = '0' WHERE `Name` = '%s'", query);
db_query(Database,query);
return 1;
}
stock SetJail(playerid) //Polizei Knast Setzen
{
new query[128];
new jail[128];
GetPlayerName(playerid,query,MAX_PLAYER_NAME);
format(query,128,"UPDATE `USERS` SET `JAILED` = '1' WHERE `Name` = '%s'", query);
db_query(Database,query);
return 1;
}
stock LoadJailTime(playerid)
{
new query[128];
new name[128];
GetPlayerName(playerid,query,MAX_PLAYER_NAME);
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(query,128,"SELECT `JAILTIME` FROM `USERS` WHERE `Name` = '%s'",query);
new DBResult:result = db_query(Database, query);
new str[5];
if(db_num_rows(result)) db_get_field(result, 0, str, sizeof(str));
JailTime[playerid] = strval(str);
printf("playerid: %d / JailTime: %d / name: %s", playerid, JailTime[playerid], name);
SetTimerEx("UnPrison", JailTime[playerid], false, "d", playerid);
}
//SetTimer("message", 1000, false); // Set a timer of 1000 miliseconds (1 second)
stock UnPrison(playerid)
{
UnJailTime(playerid);
UnJail(playerid);
}