Getting Players Weapon Slots
#1

Hey,

On my script I have to save and load players weapons from different slots how to I save a players weapon from a certain slot?

Thanks,

-Dark
Reply
#2

pawn Код:
stock GetWeaponSlot(weapon)
{
    new slot;
    switch (weapon)
    {
        case 0: slot = 0;
        case 1: slot = 0;
        case 2: slot = 1;
        case 3: slot = 1;
        case 4: slot = 1;
        case 5: slot = 1;
        case 6: slot = 1;
        case 7: slot = 1;
        case 8: slot = 1;
        case 9: slot = 1;
        case 22: slot = 2;
        case 23: slot = 2;
        case 24: slot = 2;
        case 25: slot = 3;
        case 26: slot = 3;
        case 27: slot = 3;
        case 28: slot = 4;
        case 29: slot = 4;
        case 32: slot = 4;
        case 30: slot = 5;
        case 31: slot = 5;
        case 33: slot = 6;
        case 34: slot = 6;
        case 35: slot = 7;
        case 36: slot = 7;
        case 37: slot = 7;
        case 38: slot = 7;
        case 16: slot = 8;
        case 17: slot = 8;
        case 18: slot = 8;
        case 39: slot = 8;
        case 41: slot = 9;
        case 42: slot = 9;
        case 43: slot = 9;
        case 10: slot = 10;
        case 11: slot = 10;
        case 12: slot = 10;
        case 13: slot = 10;
        case 14: slot = 10;
        case 15: slot = 10;
        case 44: slot = 11;
        case 45: slot = 11;
        case 46: slot = 11;
        case 40: slot = 12;
    }
    return slot;
}
Reply
#3

Okay thanks but after trying alot of methods I have this:
pawn Код:
GetPlayerWeaponData(playerid,GetWeaponSlot(GetPlayerWeapon(playerid)),GetPlayerWeapon(playerid),GetPlayerAmmo(playerid)));
I get:
Код:
C:\Users\Michael\Desktop\Los Santos Cops And Robbers\gamemodes\LosSantosCopsAndRobbers.pwn(925 -- 957) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Any ideas on how to solve?
Reply
#4

The third and fourth parameters have to be variables to assume the values.

pawn Код:
new weaponid, ammo;
GetPlayerWeaponData(playerid, GetWeaponSlot(GetPlayerWeapon(playerid)), weaponid, ammo);
If you want to save all player weapons, will have that use a loop with GetPlayerWeaponData to get all weapons in all slots.

Here's an example:

http://forum.sa-mp.com/showpost.php?...0&postcount=15
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)