22.09.2012, 11:55
(
Последний раз редактировалось fiki574; 22.09.2012 в 12:43.
)
opc.inc
Released on 22/9/2012
INTRO:
First release after long time (don't count update releases)! The reason of creation of this include is that I indeed need something like this for my new-old gamemode I am doing on! This can be used in all ways you can imagine - for AFK system, speed hack detection, airbraking, drift points counting and much more! Here's the include!
P.S. This post will be short!
![Wink](images/smilies/wink.png)
__________________________________________________ __________________________________________________
INCLUDE:
There isn't any native functions, but there are two custom callbacks which are:
pawn Код:
OnPlayerChangeAngle(playerid, Float:old_angle, Float:new_angle);
OnPlayerChangePosition(playerid, Float:old_x, Float:old_y, Float:old_z, Float:new_x, Float:new_y, Float:new_z);
pawn Код:
#define TIMER_TIME 1*1000 //found in "opc.inc"
new count[MAX_PLAYERS] = 0;
public OnPlayerChangeAngle(playerid, Float:old_angle, Float:new_angle)
{
if(old_angle < new_angle || old_angle > new_angle)
{
count[playerid] = 0;
printf("Player %d changed their angle from %f to %f", playerid, old_angle, new_angle);
}
else if(old_angle == new_angle)
{
count[playerid]++;
printf("Player %d hasn't changed their angle!", playerid);
if(count[playerid] == 30)
{
printf("Player %d hasn't changed their angle for 30 seconds, therefor they may be AFK!", playerid);
}
}
KillTimer(CheckTimer[playerid]);
return 1;
}
pawn Код:
#define TIMER_TIME 1*1000 //found in "opc.inc"
new count2[MAX_PLAYERS] = 0;
public OnPlayerChangePosition(playerid, Float:old_x, Float:old_y, Float:old_z, Float:new_x, Float:new_y, Float:new_z)
{
if(old_x != new_x || old_y != new_y || old_z != new_z)
{
count2[playerid] = 0;
printf("Player %d changed their position from %f,%f,%f to %f,%f,%f", playerid, old_x, old_y, old_z, new_x, new_y, new_z);
}
else if(old_x == new_x || old_y == new_y)
{
count2[playerid]++;
printf("Player %d hasn't changed their position!", playerid);
if(count2[playerid] == 30)
{
printf("Player %d hasn't changed their position for 30 seconds, therefor they may be AFK!", playerid);
}
}
KillTimer(CheckTimer2[playerid]);
}
__________________________________________________ _______________________________________________
CREDITS:
fiki574_CRO - creating everything
****** - ALS hooking
Do not re-release / use stuff from this include without noticing me!
__________________________________________________ _______________________________________________
DOWNLOAD:
Pastebin v1.0 (current, recomended)
No mirrors allowed!!