You need to add a function to replace your tazer with your Silence Pistol for example :
PHP код:
new pTazerReplace[MAX_PLAYERS];
Define that up
Now you made a define , now go under :
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
Then put that :
PHP код:
if((newstate == 2 || newstate == 3 || newstate == 7 || newstate == 9) && pTazer[playerid] == 1)
{
RemovePlayerWeapon(playerid, 23);
GivePlayerWeapon(playerid, pTazerReplace[playerid], 60000);
pTazer[playerid] = 0;
}
Now on your tazer command add under :
PHP код:
if(GetPVarInt(playerid, "Tazer") == 1)
add that :
PHP код:
pTazerReplace[playerid] = PlayerInfo[playerid][pGuns][2];
if(PlayerInfo[playerid][pGuns][2] != 0) RemovePlayerWeapon(playerid, PlayerInfo[playerid][pGuns][2]);
GivePlayerValidWeapon(playerid, 23, 60000);
Action(playerid, "takes his tazer out of his belt.");
pTazer[playerid] = 1;
Now lets add when you type /tazer again it holster the tazer
PHP код:
RemovePlayerWeapon(playerid, 23);
GivePlayerValidWeapon(playerid, pTazerReplace[playerid], 60000);
Action(playerid, "puts his tazer back into his belt.");
pTazer[playerid] = 0;
Now add under :
PHP код:
public OnPlayerConnect(playerid)
PHP код:
pTazerReplace[playerid] = 0;
That's will define when the player connects to the server it will set his tazer to 0
Now add under :
PHP код:
public OnPlayerDisconnect(playerid, reason)
PHP код:
if(pTazer[playerid] == 1) GivePlayerValidWeapon(playerid,pTazerReplace[playerid],60000);
I hope that I helped if you need any question just ask here