SA-MP Forums Archive
help me to make race spawn positions - 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: help me to make race spawn positions (/showthread.php?tid=484720)



help me to make race spawn positions - soroushdarkness13 - 01.01.2014

hi .
i want to make a race system.
how can i make some spawn positions and player will put in positions.
but this is my question : when a spawn position taken another players will not spawn there and they will spawn in diffrent place .
sry if my english is very bad


Re: help me to make race spawn positions - NikO1 - 01.01.2014

If a spawn place is set all players will spawn there.
You can make a teleport code or like when a player gets in a car he teleports somewhere etc.


Re: help me to make race spawn positions - soroushdarkness13 - 01.01.2014

no no no ! no spawn place !
a spawn place for race !
when player type /race
{
setplayerpos ....
}
but a spawn place for race i want to be just for a player !

i cant tell you my mean bad english ((((((((((


Re: help me to make race spawn positions - NikO1 - 01.01.2014

if (strcmp("/race", cmdtext, true, 10) == 0)
{
SetPlayerPos(playerid,x,y,z);
SendClientMessage(playerid,0x00FF00FF,"The message you want here");
return 1;
}

The codes for the place you want them to spawn put in setplayerpos(playerid here)


Re: help me to make race spawn positions - soroushdarkness13 - 01.01.2014

i know them.

static Floatositions[][3] =
{
367.2244, 2407.0566, 101.4031 // 1
367.2244, 2407.0566, 101.4031 // 2
367.2244, 2407.0566, 101.4031 // 3
};
here is 3 positions
but i want any position will just for one play .
and any player will spawn in diffrent positions .

but how ?


Re: help me to make race spawn positions - Mey6155 - 01.01.2014

You just use:
pawn Код:
static Float:Positions[][3] =
{
367.2244, 2407.0566, 101.4031   // 1
367.2244, 2407.0566, 101.4031   // 2
367.2244, 2407.0566, 101.4031   // 3
};
You change the [3] to how many you want.
Then you go In-Game and run where you want you're spawns, and save the position, then ****** on you're computer for Savedpositions.txt. If you got the codes just add them under each other, make sure you use "," at them all exept the last one. So example: I got 9 locations.
pawn Код:
static Float:Positions[][9] =
{
531.1244, 2457.2136, 154.4031// 1
532.2244, 6513.0566, 543.4031// 2
5125.2244, 5612.0546, 753.431// 3
755.2244, 5542.236, 4323.4031// 4
545.2244, 56552.04536, 4323.4031,   // 5
5541.244, 554.0526, 753.5431,   // 6
5541.2244, 5542.05636, 563.4031,    // 7
5435.2244, 5612.0636, 753.4031, // 8
55451.2244, 7612.0546, 5453.4031    // 9
}
Just change the positions.


Re: help me to make race spawn positions - soroushdarkness13 - 01.01.2014

no body can know me
_____________________________
when player do use /race
he will teleport to one of that positions .
and if another player typed that he will go in a diffrent place and dont go positions last player gone.


Re: help me to make race spawn positions - Mey6155 - 01.01.2014

Quote:

no body can know me
https://sampforum.blast.hk/showthread.php?tid=162488

Look to that link, when it says:
pawn Код:
public OnPlayerSpawn(playerid)
{
    new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
    return 1;
}
Copy:
pawn Код:
new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
If you use strcmp, if you use CMD:
pawn Код:
CMD:race(playerid,params[])
{
new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
return 1;
}
Strcmp:
pawn Код:
if(!strcmp(cmdtext, "/race"))
     {
        new Random = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
        return 1;
     }
This is what you mean like yes.


Re: help me to make race spawn positions - soroushdarkness13 - 01.01.2014

yes that is i want !
but this code maybe two player spawn in one position !!! ?


Re: help me to make race spawn positions - Mey6155 - 01.01.2014

Well Soroushdarnkness13 its complety random. If you want to you can make more then 100 places... But maybe the random counter did 15 twice... Well here u go