SA-MP Forums Archive
problem with goto - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: problem with goto (/showthread.php?tid=233959)



problem with goto - tanush - 02.03.2011

im using sscanf + zcmd and when i do /goto it says unknown cmd, SCRIPT!
pawn Код:
COMMAND:goto(playerid, params[])
{
    if(PlayerData[playerid][IsAdmin])
    {
        new id, Float: Pos[3];
        if(sscanf(params, "ui", id)) return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /goto [id]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "That user is not connected.");
        SendClientMessage(playerid, 0xFF9900AA, "You have teleported to that player!");
        SendClientMessage(id, 0xFF9900AA, "An admin has teleported to you!");
        return
        GetPlayerPos(id,Pos[0],Pos[1],Pos[2]);
        SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);

    }
    else return SendClientMessage(playerid,0xFF0000FF, "ERROR: You admin level isn't high enough!");
}



Re: problem with goto - Antonio [G-RP] - 02.03.2011

pawn Код:
COMMAND:goto(playerid, params[])
{
    if(PlayerData[playerid][IsAdmin])
    {
        new id, Float:Pos[3];
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /goto [id]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "That user is not connected.");
        SendClientMessage(playerid, 0xFF9900AA, "You have teleported to that player!");
        SendClientMessage(id, 0xFF9900AA, "An admin has teleported to you!");
        GetPlayerPos(id,Pos[0],Pos[1],Pos[2]);
        SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
    }
    else return SendClientMessage(playerid,0xFF0000FF, "ERROR: You admin level isn't high enough!");
}



Re: problem with goto - Steven82 - 02.03.2011

Your error was simply a easy fix. It's called not paying attention and trying to rush everything to get done..


Re: problem with goto - Antonio [G-RP] - 02.03.2011

Quote:
Originally Posted by Steven82
Посмотреть сообщение
Your error was simply a easy fix. It's called not paying attention and trying to rush everything to get done..
Bro, stop trollin'.


Re: problem with goto - tanush - 02.03.2011

thanks again antonio


Re: problem with goto - tanush - 02.03.2011

how i make if the player in car and i do /get, they teleport to me with their vehicle?


Re: problem with goto - admantis - 02.03.2011

First provide us with your /get command


Re: problem with goto - tanush - 02.03.2011

pawn Код:
COMMAND:get(playerid, params[])
{
    if(PlayerData[playerid][IsAdmin])
    {
        new id, Float:Pos[3];
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF9900AA, "USAGE: /get [id]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "That user is not connected.");
        SendClientMessage(playerid, 0xFF9900AA, "You have teleported that player to you!");
        SendClientMessage(id, 0xFF9900AA, "An admin has teleported you to him!");
        GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
        SetPlayerPos(id,Pos[0],Pos[1],Pos[2]);
    }
    else return SendClientMessage(playerid,0xFF0000FF, "ERROR: You admin level isn't high enough!");
    return 1;
}
;| (got my eyes on you)


Re: problem with goto - Antonio [G-RP] - 02.03.2011

This might help...

pawn Код:
COMMAND:get(playerid, params[])
{
    new id, Float:Pos[3];
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /get [playerid]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "ERROR: That player isn't connected.");
    if(PlayerData[playerid][IsAdmin])
    {
        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        new int = GetPlayerInterior(playerid);
        if(GetPlayerState(id) == PLAYER_STATE_ONFOOT)
        {
            SetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
            SetPlayerInterior(id, int);
        }
        if(IsPlayerInAnyVehicle(id) && GetPlayerState(id) == PLAYER_STATE_DRIVER)
        {
            new veh = GetPlayerVehicleID(id);
            new interior = GetPlayerInterior(playerid);
            SetVehiclePos(veh, x+5, y, z);
            SetPlayerInterior(id, interior);
            PutPlayerInVehicle(id, veh, 0);
        }
        SendClientMessage(playerid, -1, "You've teleported a player.");
        SendClientMessage(id, -1, "You've been teleported.");
    }
    else {
        SendClientMessage(playerid, -1, "You aren't admin!");
    }
    return 1;
}