[HELP] How to make auto Giveweapon Minigun to all player? +REP1
#3

Here you go:

pawn Код:
#define MAX_AMMO 6000

/* This one requires you to have the foreach loops */
massGiveMiniguns(gunid, ammo = -1) {
    foreach(Player, i) {
        if(IsPlayerConnected(i)) {
            ResetPlayerWeapons(i);
            if(ammo != -1) {
                GivePlayerWeapon(i, gunid, ammo);
            } else {
                GivePlayerWeapon(i, gunid, MAX_AMMO);
            }
        }
    }
}

/* If you don't have the foreach loops, use this one */
massGiveGun(gunid, ammo = -1) {
    for(new i=0; i<MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
            ResetPlayerWeapons(i);
            if(ammo != -1) {
                GivePlayerWeapon(i, gunid, ammo);
            } else {
                GivePlayerWeapon(i, gunid, MAX_AMMO);
            }
        }
    }
}

YCMD:massgivegun(playerid, params[], help) {    //I recommend using the YCMD command processor if you aren't using it already..
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Gives weapons to all the players");
        return 1;
    }
    new weaponid, ammo;
    if(!sscanf(params, "dd", weaponid, ammo)) {
        massGiveGun(weaponid);
        SendClientMessage(playerid, COLOR_LIGHTGREEN, "[Notice]: Weapons given!");
    } else {
        SendClientMessage(playerid, X11_WHITE, "Usage: /massgivegun <weaponid> <ammo>)
    }
    return 1;
}

//Minigun id is 38 I believe
Reply


Messages In This Thread
[HELP] How to make auto Giveweapon Minigun to all player? +REP1 - by VenomMancer - 14.10.2013, 19:18
Re: [HELP] How to make auto Giveweapon Minigun to all player? +REP1 - by edzis84 - 14.10.2013, 20:38
Re: [HELP] How to make auto Giveweapon Minigun to all player? +REP1 - by InglewoodRoleplay - 14.10.2013, 21:04
Re: [HELP] How to make auto Giveweapon Minigun to all player? +REP1 - by VenomMancer - 16.10.2013, 15:33

Forum Jump:


Users browsing this thread: 2 Guest(s)