SA-MP Forums Archive
variables - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: variables (/showthread.php?tid=369071)



variables - Xbowman - 15.08.2012

how can i use variables in pawno?


Re : variables - Naruto_Emilio - 16.08.2012

Wiki is your teacher in this part
https://sampwiki.blast.hk/wiki/Scripting_Basics#Variables


Re: variables - Devilxz97 - 16.08.2012

pawn Код:
#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;
}
just an example;