27.04.2010, 16:32
How do that when ammo go-s 0 then set something off?
new
iNewPlayerWeapon[MAX_PLAYERS],
iPlayerWeapon[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
iNewPlayerWeapon[playerid] = GetPlayerWeapon(playerid);
if(iNewPlayerWeapon[playerid] != iPlayerWeapon[playerid])
{
OnPlayerWeaponChange(playerid, iNewPlayerWeapon[playerid], iPlayerWeapon[playerid]);
iPlayerWeapon[playerid] = iNewPlayerWeapon[playerid];
}
return 1;
}
forward OnPlayerWeaponChange(playerid, newweapon, oldweapon);
public OnPlayerWeaponChange(playerid, neweapon, oldweapon)
{
new
weapons[13][2],
i = 0;
for (; i < 13; i++) GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
for (i = 0; i < 13; i++) if (weapons[i][0] == oldweapon) i = 30;
if (i != 30)
{
//player ran out of ammo on a weapon
}
return 1;
}
Originally Posted by [N
BL!nk ]
I don't understand.. Example? |
GivePlayerWeapon(GetPlayerWeapon(playerid),200);
new tmp = GetPlayerWeaponState(playerd);
if(tmp == WEAPONSTATE_NO_BULLETS) {
//player has no ammo
}
//https://sampwiki.blast.hk/wiki/GetPlayerWeaponState
Originally Posted by [___
Whitetiger [www.sampcommunity.com] ]
Код:
new tmp = GetPlayerWeaponState(playerd); if(tmp == WEAPONSTATE_NO_BULLETS) { //player has no ammo } //https://sampwiki.blast.hk/wiki/GetPlayerWeaponState |
new tmp = GetPlayerWeaponState(playerid);
if(tmp == WEAPONSTATE_NO_BULLETS) {
if(tmp == 4){PlayerInfo[playerid][psomething]=0;}//???
}
Originally Posted by dice7
I wrote this completely out of my head. Not sure if It'll work, but, afaik, it should
pawn Код:
|