[HELP] Goto Problem
#1

Hello!

I have a problem with my goto command...I have a world system. Drift world, Stunt world and RP world. But I dont want, when a player is in Drift world (world id 0) he can tele to a player, who is in RP(world id 2) or in Stunt world(world id 1). Player can not tele to player, who is in other world. How to do that?

+rep, who can help me and when it works!

Thank you!

Goto Command.
pawn Код:
dcmd_goto(playerid, params[])
    {
    if(IsInDM[playerid] ==1)
    {
    SendClientMessage(playerid,COLOR_RED,"ERROR: {FFFFFF}You can not use commands in DM use /leavedm");
    return 1;
    }
    #pragma unused params
    new ID;
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /goto [ID]");
    else if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}This player is offline or it is yourself");
    if(toggoto[ID] == 1)
    {
    SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}This player has DISABLED goto command or is in DM /toggoto");
    return 1;
    }
    else
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(ID, x, y, z);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    SetVehiclePos(GetPlayerVehicleID(playerid), x+4, y, z);
    else SetPlayerPos(playerid, x+2, y, z);
    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ID));
    }
    return 1;
    }
This command is with /toggoto...
Reply
#2

pawn Код:
dcmd_goto(playerid, params[])
{
    new ID;
    if(IsInDM[playerid] == 1) SendClientMessage(playerid,COLOR_RED,"ERROR: {FFFFFF}You can not use commands in DM use /leavedm");
    else if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /goto [ID]");
    else if(!IsPlayerConnected(ID) || ID == playerid) SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}This player is offline or it is yourself");
    else if(toggoto[ID] == 1) SendClientMessage(playerid, COLOR_RED, "ERROR: {FFFFFF}This player has DISABLED goto command or is in DM /toggoto");
    else if(GetPlayerVirtualWorld(ID) != GetPlayerVirtualWorld(playerid)) // SendClientMessage That player is in different world
    else
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(ID, x, y, z);
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            SetVehiclePos(GetPlayerVehicleID(playerid), x+4, y, z);
        else
            SetPlayerPos(playerid, x+2, y, z);

        SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ID));
    }
    return 1;
}
Reply
#3

Thank you. No errors. Hope it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)