Posted by: Vertical
« on: February 09, 2011, 04:58:22 pm »Thanks for the support. 


stock GetClosestPlayer(playerid,range = 50)
{
new splayer,jon;
if(IsPlayerConnected(playerid))
{
jon = MAX_PLAYERS * 50;
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
for(new r = range; r > 0; r--) {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(i==playerid) continue;
if(PlayerToPoint(r, i, x, y, z))
{
jon--;
splayer = i;
}
}
}
if(jon == MAX_PLAYERS * 50) splayer = INVALID_PLAYER_ID;
}
return splayer;
}
ReturnUser(const playername[], user = INVALID_PLAYER_ID)i will release some more soon,
{
new i;
new hasmultiple=-1;
new ourplayer = -1;
new tmpuname[MAX_STRING];
for (i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i,tmpuname,sizeof(tmpuname));
if (strfind(tmpuname,playername,true) != -1)
{
hasmultiple++;
ourplayer = i;
}
if (hasmultiple>0)
{
SendClientMessage(user,ARED,"More Then One Player Found, Please Be More Accurate!");
return INVALID_PLAYER_ID;
}
}
}
if(IsNumeric(playername) && IsPlayerConnected(strval(playername)))
{
hasmultiple++;
ourplayer = strval(playername);
if (hasmultiple>0)
{
SendClientMessage(user,0xA80000FF,"More Then One Player Found, Please Be More Accurate!");
return INVALID_PLAYER_ID;
}
}
return ourplayer;
}
