SA-MP Forums Archive
player teleport to admin - 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: player teleport to admin (/showthread.php?tid=331525)



player teleport to admin - squomp - 05.04.2012

// player tele to admin//////////////////////////////////////
dcmd_ptele(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You do not have permission to use this command");

static ID, Float:locx, Float:locy, Float:locz, inter;
if (sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must use /ptele [id]");
else
{
GetPlayerPos(playerid, locx, locy, locz);
inter = GetPlayerInterior(playerid);
SetPlayerInterior(ID, inter);
SetPlayerPos(ID, locx, locy+1, locz+1);
return 1;
}
}
//////////////////////////////////////////////////////////////////////////////

why wont it work, theres no errors


Re: player teleport to admin - Psymetrix - 05.04.2012

pawn Код:
dcmd_ptele(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You do not have permission to use this command");

    new ID, Float:locx, Float:locy, Float:locz, inter;
    if (sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must use /ptele [id]");
    GetPlayerPos(playerid, locx, locy, locz);
    inter = GetPlayerInterior(playerid);
    SetPlayerInterior(ID, inter);
    SetPlayerPos(ID, locx, locy+1, locz+1);
    return 1;
}
Make sure you have the latest plugin version of sscanf.


Re: player teleport to admin - Cjgogo - 05.04.2012

Try
pawn Код:
new ID;
instead of static and use pawn tags when you post a topic


Re: player teleport to admin - DarkScripter - 05.04.2012

pawn Код:
dcmd_ptele(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) // checks if player is admin
        return SendClientMessage(playerid, 0xFF0000FF, "You do not have permission to use this command");

    static
        pID
    ;
   
    if (sscanf(params, "u", ID)) // checks parameters
        return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must use /ptele [id]");
       
    if(!IsPlaterConnected(ID)) // checks if player connected
        return SendClientMessage(playerid, 0xFF0000FF,"ERROR: Player not connected!");
       
    static
        Float:locx,
        Float:locy,
        Float:locz
    ;
   
    GetPlayerPos(playerid, locx, locy, locz); // get position
    SetPlayerInterior(ID, GetPlayerInterior(playerid)); // set player interior
    SetPlayerPos(ID, locx, locy, locz+1); // set player a pos.
    return 1;
}



Re: player teleport to admin - squomp - 05.04.2012

it still dosnt work nothing happens no matter what I type /ptele, /ptele [id] nothing


Re: player teleport to admin - Cjgogo - 05.04.2012

It must work,did you try Psymetrix's version and what I said(he was faster than me :P)?If no,check if you have this in OnPlayerCommand:

pawn Код:
dcmd(ptele,5,cmdtext);



Re: player teleport to admin - squomp - 05.04.2012

it works now thanks guys