24.09.2012, 15:51
Hi every one.
i tried to make Care package like in Call of duty. and i work. but the problem only the player who called the package can take it. how to make all players can take the package..
here is the Code
i tried to make Care package like in Call of duty. and i work. but the problem only the player who called the package can take it. how to make all players can take the package..
here is the Code
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
if(newkeys & KEY_YES )
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetObjectToPlayerDistance(playerid, Package[i]) >= 3 && GetObjectToPlayerDistance(playerid, Package[i]) <= 6)
{
new rand = random(6);
switch(rand)
{
case 0:
{
SetPlayerHealth(i,100);
}
case 1:
{
SetPlayerArmour(i,100);
SendClientMessage(playerid,i,"full armour");
}
case 2:
{
YesNo[i] = 1;
SendClientMessage(playerid,i,"Seasparrow Added");
}
case 3:
{
GivePlayerWeapon(i,28,2967);
}
case 4:
{
YesNoRC[i] = 1;
SendClientMessage(i,COLOR_RED,"RC Added");
}
case 5:
{
MinigunTaken[playerid] = 1;
SendClientMessage(i,COLOR_RED,"Minigun Added");
}
}
PackageBusy = 0;
DestroyObject(Package[i]);
return 1;
}
else return ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST,"Killstreaks","RC car \nPackage \nMinigun \nSeasparrow \nAirstrike \nNuke","Use","close");
}
}
}