/giveweaponall ?
#1

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
Reply
#2

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.
Reply
#3

Can u setup methe cmd with strcmp?
Reply
#4

[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
Reply
#5

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
Reply
#6

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

Thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)