Ich habe ein SWAT Duty System gemacht, wo der LSPD'ler einen Decknamen bekommt..
Aber wenn er Off-Duty geht bleibt der Name wie der Deckname, er sollt aber wie der alte Name sein also ein Beispiel:
Ich "VitaminZ" gehe /swatduty, dann wird mein Name auf "Ansi" geändert, aber wenn ich /swatduty also Off-Duty gehe bleibt der name auf "Ansi" er soll aber wieder auf VitaminZ geändert werden.
Hier der PWN Code:
if(strcmp(cmd, "/swatduty", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsACop(playerid))
{
if (IsPlayerInRangeOfPoint(playerid,3.0,227.6519,111.8072,1003.2188) ||IsPlayerInRangeOfPoint(playerid,3.0,255.3,77.4,1003.6)
|| IsPlayerInRangeOfPoint(playerid,3.0,-1616.1294,681.1594,7.1875) || IsPlayerInRangeOfPoint(playerid,3.0, 217.5230,184.4352,1003.0313)
|| IsPlayerInRangeOfPoint(playerid,3.0, 217.8921,78.9727,1005.0391)
|| PlayerInfo[playerid][pLocal] != 255)
{
if(OnDuty[playerid]==0)
{
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GivePlayerWeapon(playerid, 41, 500); //spray
GivePlayerWeapon(playerid, 3, 1); //Nightstick
GivePlayerWeapon(playerid, 25, 100); //Shotgun
GivePlayerWeapon(playerid, 24, 500); //Desert Eagle
GivePlayerWeapon(playerid, 29, 500); //MP5
OnDuty[playerid] = 1;
new rand = random(5);
if(rand == 0)return SetPlayerName(playerid,"Dos");
if(rand == 1)return SetPlayerName(playerid,"Ansi");
if(rand == 2)return SetPlayerName(playerid,"Ins");
if(rand == 3)return SetPlayerName(playerid,"Length");
if(rand == 4)return SetPlayerName(playerid,"Sel");
if(rand == 5)return SetPlayerName(playerid,"Col");
}
else if(OnDuty[playerid]==1)
{
format(string, sizeof(string), "* Officer %s legt seine Marke in den Schrank und macht Feierabend.", sendername);
SetPlayerName(playerid,"/Accounts/%s.ini");
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
ResetPlayerWeapons(giveplayerid);
PlayerInfo[giveplayerid][pGun1] = 0; PlayerInfo[giveplayerid][pAmmo1] = 0;
PlayerInfo[giveplayerid][pGun2] = 0; PlayerInfo[giveplayerid][pAmmo2] = 0;
PlayerInfo[giveplayerid][pGun3] = 0; PlayerInfo[giveplayerid][pAmmo3] = 0;
PlayerInfo[giveplayerid][pGun4] = 0; PlayerInfo[giveplayerid][pAmmo4] = 0;
OnDuty[playerid] = 0;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " Du bist in keiner Umkleide !");
return 1;
}
}
}
return 1;
}
//Die Zeilen sind i.wie verrutscht keine Ahnung wieso.
Aber der Code klappt