06.02.2013, 16:49
Hello, i have an Question how to make that when an Player die and he buyed an Weapon, that the Weapon get not reseted after Death?
new
weapInfo[MAX_PLAYERS][2];
weapInfo[playerid][0] = WEAPON_ID;
weapInfo[playerid][1] = WEAPON_AMMO;
new
bool:justDied[MAX_PLAYERS] = false; // top of your script
justDied[playerid] = true; // under OnPlayerDeath
if(justDied[playerid])
{
GivePlayerWeapon(playerid, weapInfo[playerid][0], weapInfo[playerid][1]);
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(playerid) == TEAM_HUMAN) justDied[playerid] = true;
return 1;
}
ResetPlayerWeaponStats(playerid);
stock ResetPlayer(playerid) { ResetPlayerWeaponStats(playerid); return 1; } stock ResetPlayerWeaponStats(playerid) { ResetPlayerWeapons(playerid); for(new i=1;i==45;i++) { PlayerWeapon[playerid][i] = 0; } return 1; }
if(GetPlayerTeam(playerid) == TEAM_ZOMBIE) ResetPlayerWeaponStats(playerid);
new PlayerWeapon[MAX_PLAYERS][45];
stock GivePlayerWeaponEx(playerid,weaponid,ammo) { PlayerWeapon[playerid][weaponid] = 1; GivePlayerWeapon(playerid,weaponid,ammo); return 1; }
case DIALOG_WEAPONS: { switch(listitem) // ShowPlayerDialog(playerid,DIALOG_WEAPONS,DIALOG_STYLE_LIST,"WEAPON MENU","9mm's - $250\nSilenced 9mm - $500\nSawnoffs - $1000\nCombat shotgun - $1500\nMicro UZIs - $2000\nMP5 - $2500\nAK47 - $3000","OKAY","CANCEL"); { case 0: { if(PlayerMoney[playerid] < 1500) return SendClientMessage(playerid,COLOR_RED,"«| You need $1500! |»"); GivePlayerMoneyEx(playerid,-1500); GivePlayerWeaponEx(playerid,22,9999); format(str,144,"«| %s has bought 9mms using /shop |»",PlayerName[playerid]); SendClientMessageToAll(0xFF997FFF,str); }