Setworld/Proxdetector bug
#1

Hi, Basicly I set my world to five and my friend keeps world 0, if he talks I will still see it. Anyone know how to get rid of this?
pawn Код:
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
I have this but it still wont work.

The proxdetector im using.

pawn Код:
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;
}
Reply
#2

Show us how you change your world (whole command or what it is), and show us the entire function where you show the message.
Reply
#3

Try them under each other.
pawn Код:
if(IsPlayerConnected(i)) {
if(GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid)) {
Reply
#4

Here is /world

pawn Код:
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;
}

And /setworld for admins

pawn Код:
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;
}
And onplayertext

pawn Код:
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;
}
Reply
#5

try a /fixworld

pawn Код:
CMD:fixworld(playerid, params)
    {
    SetPlayerVirtualWorld(playerid, 0);
    SendClientMessage(playerid, -1, "Your world has been set to ours.");
    }
So when you are not in that world, type the command and it should fix you
Reply
#6

Quote:
Originally Posted by Mattakil
Посмотреть сообщение
try a /fixworld

pawn Код:
CMD:fixworld(playerid, params)
    {
    SetPlayerVirtualWorld(playerid, 0);
    SendClientMessage(playerid, -1, "Your world has been set to ours.");
    }
So when you are not in that world, type the command and it should fix you
Did you even possibly read what I wrote?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)