SA-MP Forums Archive
/giveweaponall ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /giveweaponall ? (/showthread.php?tid=185119)



/giveweaponall ? - Face9000 - 23.10.2010

Hi all,i need a simple command:

/giveweaponall WEAP ID AMMO

If i use that i command,i give specified weapon at all players on the server.

Thanks


Re: /giveweaponall ? - Calgon - 23.10.2010

pawn Код:
CMD:giveweaponall(playerid, params[]) {
    if(isnull(params)) return SendClientMessage(playerid, 0xFFFF00AA, "Syntax: /giveweaponall [weaponid]");
    for(new i; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) GivePlayerWeapon(i, strval(params), 99999);
    }
}
You need ZCMD to use this. Anyone on the server can use the command above ^, it gives infinite ammo with the weaponid you add when you type /giveweaponall.

pawn Код:
CMD:giveweaponall(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return 1;
    if(isnull(params)) return SendClientMessage(playerid, 0xFFFF00AA, "Syntax: /giveweaponall [weaponid]");
    for(new i; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) GivePlayerWeapon(i, strval(params), 99999);
    }
}
The code above requires the person who types the command to have RCON admin, if they are not RCON admin, nothing happens when they type the command.


Re: /giveweaponall ? - Face9000 - 23.10.2010

Can u setup methe cmd with strcmp?


Re: /giveweaponall ? - pushingmyluck - 23.10.2010

[pawn]
pawn Код:
if (strcmp(cmd, "/givegunall", true)==0)
    {
            if (PlayerInfo[playerid][pLCAdmin] >= 12000)
            {
                tmp = strtok(cmdtext, idx);
                if      (!strlen(tmp))
                {
                        SendClientMessage(playerid, 0xFFFFFFAA, "USO: /givegunall [weapon]");
                        return 1;
                }
                new w = strval(tmp);
                for (new i=0;i<MAX_PLAYERS;i++)if(IsPlayerConnected(i))
                GivePlayerWeaponEx(i,w,10000);
            }
            return 1;
    }
tell me if this works if not repaost here


Re: /giveweaponall ? - xinix000 - 23.10.2010

pawn Код:
if      (strcmp(cmd, "/givegunall", true)==0)
    {
            if (PlayerInfo[playerid][pLCAdmin] >= 12000)
            {
                tmp = strtok(cmdtext, idx);
                if      (!strlen(tmp))
                {
                        SendClientMessage(playerid, 0xFFFFFFAA, "USO: /givegunall [weapon]");
                        return 1;
                }
                new w = strval(tmp);
                for (new i=0;i<MAX_PLAYERS;i++)if(IsPlayerConnected(i))
                GivePlayerWeaponEx(i,w,10000);
            }
            return 1;
    }

Change it to your own


Re: /giveweaponall ? - xinix000 - 23.10.2010

Quote:
Originally Posted by xinix000
Посмотреть сообщение
pawn Код:
if      (strcmp(cmd, "/givegunall", true)==0)
    {
            if (PlayerInfo[playerid][pLCAdmin] >= 12000)
            {
                tmp = strtok(cmdtext, idx);
                if      (!strlen(tmp))
                {
                        SendClientMessage(playerid, 0xFFFFFFAA, "USO: /givegunall [weapon]");
                        return 1;
                }
                new w = strval(tmp);
                for (new i=0;i<MAX_PLAYERS;i++)if(IsPlayerConnected(i))
                GivePlayerWeaponEx(i,w,10000);
            }
            return 1;
    }

Change it to your own
i use it in my server


Re: /giveweaponall ? - Face9000 - 23.10.2010

Thanks a lot!