Guten Tag,
Ich arbeite schon seit längerem an einem Befehl welcher aber nie funktioniert und zwar:
if(strcmp("/arrest", cmd, true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid))
{
if(OnDuty[playerid] != 1)
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du bist nicht im Dienst!");
return 1;
}
if(PlayerToPoint(6.0, playerid, 198.1741,158.6524,1003.0234) || PlayerToPoint(6.0, playerid, 268.5258,77.6269,1001.0391) || PlayerToPoint(6.0, playerid, 268.4561,84.9885,1001.0391) || PlayerToPoint(6.0, playerid, 321.8767,314.1259,999.1484))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_BENUTZETEXT, "Benutze: /arrest [Preis] [Kaution (0=Nein 1=Ja)] [Kautionspreis]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 200000) { SendClientMessage(playerid, COLOR_ERRORTEXT, " Gefängnispreis kann nur zwischen $1 und $200000 liegen!"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_BENUTZETEXT, "Benutze: /arrest [Preis] [Kaution (0=Nein 1=Ja)] [Kautionspreis]");
return 1;
}
new bail = strval(tmp);
if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_ERRORTEXT, " Kaution kann nur mit 0 oder 1 festgelegt werden!"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_BENUTZETEXT, "Benutze: /arrest [Preis] [Kaution (0=Nein 1=Ja)] [Kautionspreis]");
return 1;
}
new bailprice = strval(tmp);
if(bailprice < 0 || bailprice > 100000000) { SendClientMessage(playerid, COLOR_ERRORTEXT, " Gefängnis Kaution kann nur zwischen $0 und $100.000.000 liegen!"); return 1; }
new suspect = GetClosestPlayer(playerid);
if(IsPlayerConnected(suspect))
{
if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
{
GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[suspect][pWantedLevel] < 1)
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Der Spieler muss mindestens Wanted Level 1 haben!");
return 1;
}
format(string, sizeof(string), "* Du hast %s eingesperrt!", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
new SteuerkasseMoney = moneys;
GivePlayerMoneys(playerid, moneys/2);
StuffInfo[sSteuerkasse] += SteuerkasseMoney/2;
StuffInfo[sEinnahmen] += SteuerkasseMoney/2;
format(string, sizeof(string), "Eingesperrt von %s ~n~fuer $%d", sendername, moneys);
GameTextForPlayer(suspect, string, 5000, 5);
ResetPlayerWeapon(suspect);
if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
{
format(string, sizeof(string), "<< FBI Agent %s hat den Verdächtigen %s eingesperrt >>", sendername, giveplayer);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
else if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
{
format(string, sizeof(string), "<< LSPD Officer %s hat den Verdächtigen %s eingesperrt >>", sendername, giveplayer);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
else if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
{
format(string, sizeof(string), "<< SFPD Officer %s hat den Verdächtigen %s eingesperrt >>", sendername, giveplayer);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
else if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
format(string, sizeof(string), "<< LVPD Officer %s hat den Verdächtigen %s eingesperrt >>", sendername, giveplayer);
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
if(PlayerToPoint(6.0, playerid, 198.1741,158.6524,1003.0234))
{
PlayerInfo[suspect][pJailed] = 1;
SetPlayerInterior(suspect, 3);
SetPlayerPos(suspect,198.8241,161.8588,1003.0300);
}
if(PlayerToPoint(6.0, playerid, 268.5258,77.6269,1001.0391) || PlayerToPoint(6.0, playerid, 268.4561,84.9885,1001.0391) || PlayerToPoint(6.0, playerid, 321.8767,314.1259,999.1484))
{
PlayerInfo[suspect][pJailed] = 3;
SetPlayerInterior(suspect, 6);
new zufall = random(3);
if(zufall == 1)
{
SetPlayerPos(suspect, 264.3521,82.2144,1001.0391);
}
else if(zufall == 2)
{
SetPlayerPos(suspect, 264.1788,86.7012,1001.0391);
}
else
{
SetPlayerPos(suspect, 264.7485,77.6824,1001.0391);
}
PlayerInfo[suspect][pLocal] = -1;
}
PlayerInfo[suspect][pJailTime] = PlayerInfo[suspect][pWantedLevel]* 3 * 60;
if(bail == 1)
{
JailPrice[suspect] = bailprice;
format(string, sizeof(string), "Du wurdest für %d Minuten eingesperrt. Kaution: $%d", PlayerInfo[suspect][pJailTime]/60, JailPrice[suspect]);
SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
}
else
{
JailPrice[suspect] = 0;
format(string, sizeof(string), "Du wurdest für %d Minuten eingesperrt. Kaution: Unmöglich", PlayerInfo[suspect][pJailTime]/60);
SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
}
SetPlayerFree(suspect, playerid, string, 0);
PlayerInfo[suspect][pArrested] += 1;
PlayerInfo[suspect][pWantedLevel] = 0;
WantLawyer[suspect] = 1;
format(string,sizeof(string),"%s hat den Verdächtigen %s eingesperrt", sendername, giveplayer);
EnterToLog("arrest",string);
}
}
else
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Niemand ist in deiner Nähe den du einsperren kannst !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du bist nicht in der Nähe der Zellen !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ERRORTEXT, " Du bist kein Polizist / FBI Agent Soldier !");
return 1;
}
}
return 1;
}
Preis und Zeit sollen sie Automatisch berechnen.
Danke im vorraus.