30.12.2011, 19:41
Код:
forward GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z); forward IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius); public GetPlayerDistanceToPointEx(playerid,Float:x,Float:y,Float:z) { new Float:x1,Float:y1,Float:z1; new Float:tmpdis; GetPlayerPos(playerid,x1,y1,z1); tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2)+floatpower(floatabs(floatsub(z,z1)),2)); return floatround(tmpdis); } public IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,radius) { if(GetPlayerDistanceToPointEx(playerid,x,y,z) < radius){ return 1; } return 0; }
Код:
//add to your command new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid,X, Y, Z) for (new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerInSphere(i,X, Y, Z, radius)) { SetPlayerSkin(i,skin); } }