[Help needed] Adding several weapons not abled under a command.
#1

Alright, so i have a command /putgun 1/2. And i need to set big weapons like AK-47, M4, Shotgun, Sawnoff, MP5 etc. disabled for /putgun 1, and all small weapons disabled to store for command /putgun 2. Small weapons are Deagle, Colt45, UZI and Tec9 ofc.

Shoukd it be done with GetPlayerWeapon? If so, how can i make it for every of those weapons? :/
Reply
#2

PHP код:
stock IsABigWeapon(playerid)
{
    switch(
GetPlayerWeapon(playerid))
    {
        case 
30,31,24,23,29: return 1;
    }
    return 
0;

The put a restriction on /putgun1 like

PHP код:
if(!IsABigWeapon)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"You can't put this weapon.");
                return 
1;
            } 
Then you do same for the small ones, with different id's of course.

PS: I'm not sure about the shawnoff id (23)
Reply
#3

Ok. And sawnoff is not ID 23, that's SD lol. And i should put something like "new IsABigWeapon();" in the start of the whole script?
Reply
#4

Quote:
Originally Posted by Daddy Yankee
Посмотреть сообщение
The put a restriction on /putgun1 like

PHP код:
if(!IsABigWeapon)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"You can't put this weapon.");
                return 
1;
            } 
I did that, and i get this:
pawn Код:
C:\Users\Da' J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3d V4.2\gamemodes\larp.pwn(32322) : error 076: syntax error in the expression, or invalid function call
C:\Users\Da'
J'\Desktop\GTA San Andreas modfiles\Raven's Roleplay 0.3d V4.2\gamemodes\larp.pwn(32341) : error 076: syntax error in the expression, or invalid function call
Helps?
Reply
#5

EDITED:

pawn Код:
if(!IsABigWeapon(playerid))
{
    SendClientMessage(playerid, COLOR_GRAD1, "You can't put this weapon.");
    return 1;
}
Reply
#6

Well now it works. Thank you, i should've notice that even myself tho lol. But thanks man.
Reply
#7

But that checks if they HAVE a big weapon on their player already, surely you want to prevent that?

pawn Код:
stock GetWeaponSize(weaponid)
{
    switch(weaponid)
    {
        case 1, 2, 3, 4: return 1;
        case 5, 6, 7, 8: return 2;
        default: return 0;
    }
}

// Weapons 1-4 are marked as 'small guns' and 5-8 as 'big guns'
// IDs that aren't listed as big or small will be restricted

// For putgun 1:

if(GetWeaponSize(weaponid) != 1) return SendClientMessage(playerid, 0xFF0000FF, "Only small weapons may be used.");

// For putgun 2:

if(GetWeaponSize(weaponid) != 2) return SendClientMessage(playerid, 0xFF0000FF, "Only big weapons may be used.");
Un-tested, not sure if it even compiles, though the theory is correct.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)