if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
//==============================================================================
public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
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);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
{
SendClientMessage(i, col5, string);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
return 1;
}
if(IsPlayerConnected(i)) {
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid)) {
LEANCMD:(world)
{
new
world,
string[126];
if(sscanf(params, "i", world)) return SendClientMessage(playerid, 0xF97804FF, "USAGE: /world [WorldID]");
if (IsPlayerInAnyVehicle(playerid))
{
format(string, sizeof(string), "You cant use this while being in a vehicle.");
}
else
{
SetPlayerVirtualWorld(playerid, world);
format(string, sizeof(string), "Your virtual world have been set to %i",world);
}
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
LEANCMD:(setworld)
{
new
world,
id,
string[126];
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_LIGHTRED, "ACCESS DENIED");
if(sscanf(params, "ui", id, world)) return SCM(playerid, COLOR_LIGHTRED, "USAGE: /setworld [PoN/ID] [WorldID]");
if(IsPlayerInAnyVehicle(id))
{
RemovePlayerFromVehicle(id);
SetPlayerVirtualWorld(id, world);
format(string, sizeof(string), "Your world have been set to %i by Admin %s", world, GetName(playerid));
SendClientMessage(id, COLOR_LIGHTRED, string);
format(string, sizeof(string), "You have set %s's virtual world to %i", GetTName(id), world);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
else
{
SetPlayerVirtualWorld(id, world);
format(string, sizeof(string), "Your world have been set to %i by Admin %s", world, GetName(playerid));
SendClientMessage(id, COLOR_LIGHTRED, string);
format(string, sizeof(string), "You have set %s's virtual world to %i", GetTName(id), world);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
return 1;
}
if (realchat && IsSpecing[playerid] == 0)
{
new sendername[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, sendername, sizeof(sendername));
sendername[strfind(sendername,"_")] = ' ';
format(string, sizeof(string), "%s says: %s", sendername, text);
ProxDetector(20.0, playerid, string ,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE3,COLOR_FADE3);
format(string,sizeof(string),"[%d-%d-%d] %s says: %s ",GetDay(),GetMonth(),GetYear(),sendername, text);
Log("/logs/Emotes.txt",string);
return 0;
}
return 1;
}
CMD:fixworld(playerid, params)
{
SetPlayerVirtualWorld(playerid, 0);
SendClientMessage(playerid, -1, "Your world has been set to ours.");
}
try a /fixworld
pawn Код:
|