SetPlayerPos issue (unsolved)
#1

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
Reply
#2

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;
}
Reply
#3

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;
}
Reply
#4

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!
Reply
#5

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?
Reply
#6

You have #include <zcmd>?

if you are using OnPlayerCommandText, remove that include.
Reply
#7

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
Reply
#8

Did you added the mapping codes to your OnGameModeInIt?
Reply
#9

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.
Reply
#10

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

Sorry next time I will use the scripting help category.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)