variables
#1

how can i use variables in pawno?
Reply
#2

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

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;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)