SA-MP Forums Archive
I can't seem to get the coords working - 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: I can't seem to get the coords working (/showthread.php?tid=365666)



I can't seem to get the coords working - Eminem 2ka9 - 03.08.2012

This is where I want the person to spawn when they die AddPlayerClass(285,185.6111,1929.7433,17.7739,177. 7806,0,0,0,0,0,0); //

Heres the code public OnPlayerDeath( playerid, killerid, reason )
{
SendDeathMessage( killerid, playerid, reason );
SetPlayerPos( playerid, 2134.5957,1332.6907,10.8251 );

But if I enter the coords there I just get errors, I heard you were suppose to only use certain ones but I'm just a noob.
I got the coords from "savedpostions" btw. I'd also like the person to spawn at 3 different places in Las Venturas so people have a chance of fighting back! Thanks a lot!!


Re: I can't seem to get the coords working - [KHK]Khalid - 03.08.2012

It's not a good idea to use SetPlayerPos under OnPlayerDeath because it will have no effect. You should use it under OnPlayerSpawn. For random spawns you gotta use the function random. Example:
pawn Код:
public OnPlayerSpawn(playerid) // called when a player spawns
{
    new randSpawn = random(3); // gets a pseudo-random number from 0 to 2.
    switch(randSpawn)
    {
        case 0: // if random generated 0
        {
            // Put your first spawn code.
        }
        case 1: // if random generated 1
        {
            // Put your second spawn code.
        }
        case 2: // if random generated 2
        {
            // Put your third spawn code.
        }
    }
    return 1;
}



Re: I can't seem to get the coords working - Eminem 2ka9 - 03.08.2012

Yea but it's 285,185.6111,1929.7433,17.7739,177. 7806,0,0,0,0,0,0); // that I have trouble of finding the coords (this is area 51)


Re: I can't seem to get the coords working - [KHK]Khalid - 03.08.2012

You only need the 2nd, 3rd and 4th parameters of AddPlayerClass, (185.6111, 1929.7433, 17.7739) are what you need:

pawn Код:
X: 185.6111
Y: 1929.7433
Z: 17.7739
This is how you use them in SetPlayerPos
pawn Код:
SetPlayerPos(playerid, 185.6111, 1929.7433, 17.7739);



Re: I can't seem to get the coords working - Vince - 03.08.2012

Next time just use /rs (raw save) instead of /save if you're having trouble identifying. This wil only get the players x, y, z and facing angle, in that order and in a separate file.


Re: I can't seem to get the coords working - Eminem 2ka9 - 03.08.2012

I got it, thanks a ton.