#1

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

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

Translation
How ??
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)