11.03.2015, 21:43
Quote:
So try it like this:
Code:
public OnPlayerUpdate(playerid) { if(suPatlamaInmeCikma[playerid] == 1) { new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); if(IsPlayerInRangeOfPoint(playerid, 0.5, X, Y, 0.0)) { new pName[MAX_PLAYER_NAME],string[128]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); new pID = GetClosestPlayer(playerid); if(pID == INVALID_PLAYER_ID) { format(string,128,"[Derby] Player: %s has fallen in the water.",pName); SendClientMessageToAll(-1,string); } else { new kName[MAX_PLAYER_NAME]; GetPlayerName(pID, kName, MAX_PLAYER_NAME); format(string, 128, "[Derby] Player: %s >> %s Water Cuts", pName,kName); SendClientMessageToAll(-1,string); } ddSira--; katildim[playerid] = 0; suPatlamaInmeCikma[playerid] = 0; DestroyVehicle(ddAraba[playerid]); SetPVarInt(playerid,"katildi",0); SpawnPlayer(playerid); } } return 1; } stock GetClosestPlayer(playerid) { new Float:p[3],i,Float:x,Float:t=70.0,tmp; GetPlayerPos(playerid,p[0],p[1],p[2]); for(; i<MAX_PLAYERS; i++) { if(!IsPlayerConnected(i)) continue; x = GetPlayerDistanceFromPoint(i,p[0],p[1],p[2]); if(x < t) t = x,tmp=i; } return (t==70.0)?INVALID_PLAYER_ID:tmp; } |