SA-MP Forums Archive
Event - 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)
+--- Thread: Event (/showthread.php?tid=551511)



Event - nezo2001 - 19.12.2014

Here is the code
PHP код:
CMD:eweapon(playeridparams[])
{
new 
world GetPlayerVirtualWorld(playerid);
if(
world != 0)
{
    if(
PInfo[playerid][Level] >= 1) {
    new 
idgunammo;
    if(
sscanf(params,"uii"idgunammo)) return SendClientMessage(playerid, -1,"USAGE: /givegun [playerid/partofname] [gunid] [ammo]");
    if(
gun 47 || gun 1) return SendClientMessage(playerid, -1,"GUN ID'S: 1-47");
    if(
ammo 15000 || ammo 1) return SendClientMessage(playerid, -1,"Ammo 1-15000");
     
GivePlayerWeapon(idgunammo);
     }
        else 
//if he has not got the permissions
        
{
            
SendClientMessage(playeridCOLOR_RED"You are not admin level 3."); //return this message
        
}
    return 
1;
    }

But i want to give all players weapon that inside the world that != 0
instead for giving one player only.
Please please please Help !!


AW: Event - Flori - 19.12.2014

Loop through all players which are in the virtualworld and give them then the weapons.


Re: Event - nezo2001 - 19.12.2014

Translation
How ??


AW: Event - Flori - 19.12.2014

https://sampwiki.blast.hk/wiki/Loops
Exapmle:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(GetPlayerVirtualWorld(i)==0)
    {
        //giveweapon or what u want to do
    }
}