SA-MP Forums Archive
[HELP] How to make auto Giveweapon Minigun to all player? +REP1 - 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: [HELP] How to make auto Giveweapon Minigun to all player? +REP1 (/showthread.php?tid=469798)



[HELP] How to make auto Giveweapon Minigun to all player? +REP1 - VenomMancer - 14.10.2013

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


Re: [HELP] How to make auto Giveweapon Minigun to all player? +REP1 - edzis84 - 14.10.2013

Код:
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);



Re: [HELP] How to make auto Giveweapon Minigun to all player? +REP1 - InglewoodRoleplay - 14.10.2013

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



Re: [HELP] How to make auto Giveweapon Minigun to all player? +REP1 - VenomMancer - 16.10.2013

Nyone can help me ?

i want like UI* server