31.03.2014, 16:37
Try [ pawn ] on the code ... anyway the code you just made it's a bit wrong ... what you mad should be like "When a player presses right click, his health gets lowered." You want to make a zombie bite system so it should work like this...
I think it's wrong but it's worth trying.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) //enter shop
{
if(newkeys == KEY_AIM)
{
if(gTeam[playerid] == TEAM_ZOMBIES)
{
if(GetDistanceBetweenPlayers(playerid,playerid2) < 3)
{
if(gTeam[playerid2] !=TEAM_ZOMBIES)
{
GetPlayerHealth(playerid2, Health);
SetPlayerHealth(playerid2, Health-10);
}
}
}
}
return 1
}
stock GetDistanceBetweenPlayers(playerid,playerid2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}