SA-MP Forums Archive
[HELP] Goto Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Goto Problem (/showthread.php?tid=422500)



[HELP] Goto Problem - martin3644 - 13.03.2013

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...


Re: [HELP] Goto Problem - Jefff - 14.03.2013

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;
}



Re: [HELP] Goto Problem - martin3644 - 14.03.2013

Thank you. No errors. Hope it works