• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Help with DM
#2
Top of script:

Code:
// Array with the order of the weapons you want

new weapons[] = {WEAPON_SHOTGUN, WEAPON_SNIPER, WEAPON_SAWEDOFF};



// Array with the amount of kills for each player

new kills[MAX_PLAYERS] = {0, ...};



OnPlayerConnect:

Code:
public OnPlayerConnect(playerid)

{

? ? // Reset playerid kills on connect

? ? kills[playerid] = 0;



? ? // Give playerid first weapon with 1000 ammo

? ? ResetPlayerWeapons(playerid);

? ? GivePlayerWeapon(playerid, weapons[0], 1000);

? ? return 1;

}



OnPlayerDeath:

Code:
public OnPlayerDeath(playerid, killerid, reason)

{

? ? if(killerid != INVALID_PLAYER_ID) {

? ? ? ? // Increase killerid kills

? ? ? ? kills[killerid];



? ? ? ? //Give killerid new weapon with 1000 ammo when there are more weapons, otherwise keep last weapon

? ? ? ? if(kills[killerid] < sizeof(weapons)) {

? ? ? ? ? ? ResetPlayerWeapons(killerid);

? ? ? ? ? ? GivePlayerWeapon(killerid, weapons[kills[killerid]], 1000);

? ? ? ? }

? ? }



? ? // Reset playerid kills on death

? ? kills[playerid] = 0;

? ? return 1;

}
Always keep in mind that a lot of people are active on this forum in their spare time.

They are sacrificing time they could easily spend on things they would rather do, to help you instead.

  Reply


Messages In This Thread
Help with DM - by DaZzY - 2020-10-29, 12:29 AM
RE: Help with DM - by Freaksken - 2020-10-29, 01:41 PM
RE: Help with DM - by DaZzY - 2020-10-29, 02:31 PM
RE: Help with DM - by Awide - 2020-10-29, 04:30 PM
RE: Help with DM - by Expert* - 2020-10-30, 07:31 PM

Forum Jump: