15.08.2012, 17:36
how can i use variables in pawno?
#include a_samp
#include zcmd
new Variables[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
Variables[playerid] = 0; //reset the weapon when join the server.
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Variables[playerid] = 0;//reset the weapon when left the server.
return 1;
}
CMD:test(playerid, params[])
{
if(Variables[playerid] == 1) //will enable it and give weapon.
{
GivePlayerWeapon(playerid, 24, 100);
SendClientMessage(playerid, -1, "Variables on");
}
else if(Variables[playerid] == 0) //here it will be disable and reset the weapons.
{
ResetPlayerWeapons(playerid);
SendClientMessage(playerid, -1, "Variables off");
}
return 1;
}