28.10.2009, 19:41
a friend has made me this code but it dosnt work so how it needs :/ i dosnt understand it
Код:
#include <a_samp> forward Count(playerid); new counter[MAX_PLAYERS]; new cnt[MAX_PLAYERS]; public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/count", cmdtext, true, 10) == 0) { cnt[playerid] = SetTimerEx("Count",1000,1,"i",playerid); return 1; } return 0; } forward PlayerToPoint(Float:radi, playerid, Float:xs, Float:ys, Float:zs); public PlayerToPoint(Float:radi, playerid, Float:xs, Float:ys, Float:zs) { if(IsPlayerConnected(playerid)) { new Float:oldposx, Float:oldposy, Float:oldposz; new Float:tempposx, Float:tempposy, Float:tempposz; GetPlayerPos(playerid, oldposx, oldposy, oldposz); tempposx = (oldposx -xs); tempposy = (oldposy -ys); tempposz = (oldposz -zs); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { return 1; } } return 0; } stock GameTextForNearPlayers(playerid,Text[],time,Style) { new Float:pos[3]; GetPlayerPos(playerid,pos[0],pos[1],pos[2]); for(new i = 0;i<MAX_PLAYERS;i++){ if(IsPlayerConnected(i)){ if(PlayerToPoint(4.0,playerid,pos[0],pos[1],pos[2]))GameTextForPlayer(i,Text,time,Style);}} return 1; } public Count(playerid) { switch(counter[playerid]) { case 0:GameTextForNearPlayers(playerid,"~w~0",1000, 3); case 1:GameTextForNearPlayers(playerid,"~w~1",1000, 3); case 2:GameTextForNearPlayers(playerid,"~w~2",1000, 3); case 3:GameTextForNearPlayers(playerid,"~w~3",1000, 3); case 4:GameTextForNearPlayers(playerid,"~w~4",1000, 3); case 5:{GameTextForNearPlayers(playerid,"~w~5",1000, 3);counter[playerid]= 0;KillTimer(cnt[playerid]);} } counter[playerid]++; return 1; }