Bite key - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Bite key (
/showthread.php?tid=362111)
Bite key -
Deaglez - 23.07.2012
Umm.. I need a little help here,
I want to make my zombie bite the humans with the RMB key
Can anyone show me how
?
Thanks!!!
Re: Bite key -
Matz - 23.07.2012
pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_FIRE))
{
new Float:vec[3];
GetPlayerPos(playerid, vec[0], vec[1], vec[2]);
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 3.0, vec[0], vec[1], vec[2]))
{
SetPlayerHealth(i,GetPlayerHealth(i)-3);
}
}
return 1;
}
return 1;
}
Re: Bite key -
LaGrande - 23.07.2012
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_FIRE)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
new Float:x, Float:y, Float:z,name[24],str[128];
GetPlayerPos(i, x, y, z);
GetPlayerName(playerid,name,24);
if(IsPlayerInRangeOfPoint(playerid,5,x,y,z))
{
format(str,sizeof(str),"Zombie %s has bitten you",name);
SendClientMessage(i,-1,str);
SetPlayerHealth(i,-50);
}
return 1;
}
}
return 1;
}
just an example, u can modify it,
when the fire key is pressed and any player is near zombie then he will loose -50 health
Re: Bite key -
Rudy_ - 23.07.2012
Edit: never mind
Re: Bite key -
Deaglez - 23.07.2012
Thnx guys
! turn me back into happy