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

Hello guys

I want on my server have Auto Minigun DM

All player will get Minigun with infiniti ammo but have time limit
If time was limit, all player get default their weapon

If you understand, please make for me one

Sorry for my bad english.

+REP1
Reply
#2

Код:
forward miniguntimer(playerid);
public miniguntimer(playerid)
{
	ResetPlayerWeapons(playerid);
	return 1;
}

CMD:Yourcommand(playerid,params[])
{
	GivePlayerWeapon(playerid, 38, -1);
        SetTimer("miniguntimer", 1000, false);
	return 1;
}
If you don't want to use command for that, just set it under needed callback.

And change time to what you need, its that "1000"
Код:
SetTimer("miniguntimer", 1000, false);
Reply
#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
#4

Nyone can help me ?

i want like UI* server
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)