SA-MP Forums Archive
SetPlayerPos issue (unsolved) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: SetPlayerPos issue (unsolved) (/showthread.php?tid=582810)



SetPlayerPos issue (unsolved) - Markhoss - 23.07.2015

Hello everyone I have a problem I want to make a /teleport command on the top of this object here is the code

CreateObject(3458,4132.7002000,-1846.4000000,0.0000000,0.0000000,0.0000000,270.374 0000); //object(vgncarshade1) (79)

But I don't know how I can find the pos so I can use /save in the server to save the location of the player can someone help me please? I am trying to get the player to move to that location but I dont know how and I hope I explained my problem well I basically want for the player to move to that location on the top of the object when they use /teleport


Re: SetPlayerPos issue (unsolved) - Fancy - 23.07.2015

Use this command to teleport to the object:

Code:
CMD:tele(playerid,params[])
{
    SetPlayerPos(playerid, 3458,4132.7002000,-1846.4000000+5);
    SetPlayerInterior(playerid, /*object interior */);
    return 1;
}



Re: SetPlayerPos issue (unsolved) - Markhoss - 23.07.2015

Do I need any includes to use the code apart from #include <a_samp> ?

I tried this just with the default include and it didnt work

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/teleport", cmdtext, true, 10) == 0)
SetPlayerPos(playerid, 3458,4132.7002000,-1846.4000000+5);
SetPlayerInterior(playerid, 0);
{

return 1;
}
return 0;
}


Re: SetPlayerPos issue (unsolved) - Stanford - 23.07.2015

Here you go:

pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/teleport", cmdtext, true, 8))
    {
        SetPlayerPos(playerid, 3458,4132.7002000,-1846.4000000+5);
        SetPlayerInterior(playerid, 0);
        return 1;
    }
    return 0;
}
and you need a_samp.inc only for this

I hope I helped any feedback is appreciated!


Re: SetPlayerPos issue (unsolved) - Markhoss - 23.07.2015

Thanks so much no errors in pawn but when I actually connect to the server and type /teleport it says
SERVER: unknown command. Any suggestions?


Re: SetPlayerPos issue (unsolved) - BladeFire - 23.07.2015

You have #include <zcmd>?

if you are using OnPlayerCommandText, remove that include.


Re: SetPlayerPos issue (unsolved) - Markhoss - 23.07.2015

Ok thanks I can now use /teleport but it spawns me here http://imgur.com/qcYO7r0 instead of here http://imgur.com/u1oPzcZ what now


Re: SetPlayerPos issue (unsolved) - BladeFire - 23.07.2015

Did you added the mapping codes to your OnGameModeInIt?


Re: SetPlayerPos issue (unsolved) - Markhoss - 23.07.2015

Yes and nevermind I fixed it I had to use MTA's spawnpoint tool and copy the POS X,Y,Z and than add that to the pawn script because before it was spawning me in the quarry lol but now I at least spawn to the actual bit where I was mapping thanks anyway topic solved.


Re: SetPlayerPos issue (unsolved) - TenTen - 23.07.2015

http://forum.sa-mp.com/forumdisplay.php?f=12


Re: SetPlayerPos issue (solved) - Markhoss - 23.07.2015

Sorry next time I will use the scripting help category.