03.03.2011, 09:46
pawn Код:
//Global variable
new weapondata[13][2][MAX_PLAYERS] =
{
{{-1,...},{0,...}},{{-1,...},{0,...}},{{-1,...},{0,...}},{{-1,...},{0,...}},{{-1,...},{0,...}},
{{-1,...},{0,...}},{{-1,...},{0,...}},{{-1,...},{0,...}},{{-1,...},{0,...}},{{-1,...},{0,...}},
{{-1,...},{0,...}},{{-1,...},{0,...}},{{-1,...},{0,...}}
};//First array is for the 13 weapon slots and the second stores the weapons' ID and their ammo.
public OnPlayerDeath(playerid,killerid,reason)
{
new weapon[13],ammo[13];
new string[192],killername[MAX_PLAYER_NAME],playername[MAX_PLAYER_NAME];
for(new i = 0;i < 13;i++) GetPlayerWeaponData(playerid,i,weapon[i],ammo[i]);
for(new i = 0;i < 13;i++)
{
if(weapon[i] && ammo[i] > 0) weapondata[i][0][playerid] = weapon[i];
else if(weapondata[i][1][playerid] < 50) weapondata[i][0][playerid] = -1;
if(ammo[i] > 0) weapondata[i][1][playerid] = ammo[i];
else if(weapondata[i][1][playerid] < 50) weapondata[i][1][playerid] = 0;
}
//Some more here..
}
public OnPlayerSpawn(playerid)
{
if(!IsPlayerNPC(playerid))
{
SetTimerEx("GivePlayerWeaponsInData",80,false,"d",playerid);
//......
}
//Some more here..
}
public GivePlayerWeaponsInData(playerid)
{
for(new i = 0;i < 13;i++)
if(weapondata[i][0][playerid] != -1 && weapondata[i][1][playerid] > 0)
{
switch(weapondata[i][0][playerid])
{
case 9,18,35..38: continue;//Weapons that are legal
default: GivePlayerWeapon(playerid,weapondata[i][0][playerid],weapondata[i][1][playerid]);
}
}
SetPlayerArmedWeapon(playerid,0);
return 1;
}
because I and some other players still get it work.
Weird:/