How to save?
#1

How to save weapons slot number 2 to veriable?
Reply
#2

pawn Код:
#define MAX_WEAPONS 12
new WeaponInfo[MAX_PLAYERS][MAX_WEAPONS];

WeaponInfo[playerid][2] = weaponid;
Reply
#3

And ammo from that slot ?
Reply
#4

pawn Код:
#define MAX_WEAPONS 12
new WeaponInfo[MAX_PLAYERS][MAX_WEAPONS];
new WeaponAmmo[MAX_PLAYERS][MAX_WEAPONS];

WeaponInfo[playerid][2] = weaponid;
WeaponAmmo[playerid][2] = ammo;
Reply
#5

Check this: https://sampwiki.blast.hk/wiki/GetPlayerWeaponData

It's nice loop to save all player weapon data.

Код:
new weapons[13][2];
 
for (new i = 0; i < 13; i++)
{
    GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
}
Then I am saving these information to a User File
Reply
#6

pawn Код:
if(strcmp(cmdtext, "/tazer", true) == 0)
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
    if(IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "You are currently in a vehicle!");
        return 1;
    }
   
    if(strfind(name, "[PD]", true) == -1)
    {
              SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command.");
              return 1;
    }
    new gunID = GetPlayerWeapon(playerid);
    new Amm = GetPlayerAmmo(playerid);
   
    WeaponInfo[playerid][2] = gunID;
    WeaponAmmo[playerid][2] = Amm;
    new weapons[13][2];
        for (new i = 0; i < 13; i++)
        {
            GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
        }
        if(weapons[2][0] == 23) { WEAPON = 23; }
        if(HasTazer[playerid] == 0)
        {
            GiveTazer(playerid);
            GivePlayerWeapon(playerid, WEAPON, 50);
            return 1;
        }
        if(HasTazer[playerid] == 1)
        {
            GivePlayerWeapon(playerid, gunID, Amm);
            TakeTazer(playerid);
            return 1;
        }
        return 1;
    }
    return 0;
}
Okay this won't give weapon back to player after he removes his tazer..
Reply
#7

Anyone
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)