24.11.2016, 18:36
I use the callback to a timer
then
So, i can use a function to a timer?
Код:
SetTimerEx("test1", 90000, true, "i", playerid);
Код:
CALLBACK: test1(playerid) { new jName = INVALID_PLAYER_ID; if(ProxDetectorS(3,playerid,jName)) { Mensaje(jNombre,-1,"closest player message."); } Mensaje(playerid, -1, "i use the callback"); return 1; }
Код:
stock ProxDetectorS(Float:radi, playerid, targetid) { if(IsPlayerConnected(playerid) && IsPlayerConnected(targetid)) { new Float:posx, Float:posy, Float:posz; new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); GetPlayerPos(targetid, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } return 0; }