26.03.2011, 10:40
I tried it, it doesn't work for me.
Код:
#if !defined _samp_included #error "Please include a_samp.inc before a_other.inc!" #endif #if !defined mysql_included #error "Please include a_mysql.inc before a_other.inc!" #endif #if defined _a_other2_included #endinput #endif #define _a_other2_included #pragma library a_other2 stock explode(string[],delim[],result[][],maxsplit=0,size1 = sizeof(result), size2 = sizeof(result[])) { new track=0,idx=0, maxlen = strlen(string), tmpx; while (idx < maxlen) { //Scan the string for our search. tmpx = strfind(string,delim,true,idx); if (tmpx != -1 && ((maxsplit > 0 && track < maxsplit) || (maxsplit == 0))) { //If we found it.. strmid(result[track],string,idx,tmpx,size2); idx = tmpx + 1; } else { //..Otherwise.. strmid(result[track],string,idx,strlen(string),size2); idx = strlen(string); } track++; //..And if they are out of space in their storage array.. Shut it down. if (track > size1) idx = strlen(string); } return result; } stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5,col6) { if(IsPlayerConnected(playerid)) { 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); //radi = 2.0; //Trigger Radius for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { GetPlayerPos(i, posx, posy, posz); tempposx = (oldposx -posx); tempposy = (oldposy -posy); tempposz = (oldposz -posz); printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz); if (((tempposx < radi/32) && (tempposx > -radi/32)) && ((tempposy < radi/32) && (tempposy > -radi/32)) && ((tempposz < radi/32) && (tempposz > -radi/32))) { SendClientMessage(i, col1, string); } else if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) { SendClientMessage(i, col2, string); } else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) { SendClientMessage(i, col3, string); } else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) { SendClientMessage(i, col4, string); } else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) { SendClientMessage(i, col5, string); } else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { SendClientMessage(i, col6, string); } } else { SendClientMessage(i, col1, string); } } } //not connected return 1; } stock GetFLName(playerid) //F = First L = Last { new string[24]; GetPlayerName(playerid,string,24); new pos = strfind(string,"_", true); if(pos != -1) string[pos] = ' '; return string; } stock GetUserName(playerid) { new tehname[MAX_PLAYER_NAME]; GetPlayerName(playerid, tehname, sizeof(tehname)); return tehname; } /* stock SelectMySQL(ExplodeSplit[6][32]) { new Data[80]; mysql_fetch_row_format(Data, "|"); explode(ExplodeSplit, Data, "|"); return ExplodeSplit; } */ stock NameorIDtoID(name[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(strfind(GetUserName(i), name, true) != -1 || (IsPlayerConnected(i) && strval(name) == i && IsNumeric(name))) { return i; } } return -1; } native explode(string[],delim[],result[][],maxsplit=0,size1 = sizeof(result), size2 = sizeof(result[])); native ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5,col6); native GetFLName(playerid); //Get Firstname Lastname native GetUserName(playerid); //Get Firstname_Lastname //native SelectMySQL(ExplodeSplit[][]); // Use it between mysql_store_result() to mysql_free_result() native NameorIDtoID(name[]); //you write the name and it will reterun