Help with random spawn points
#1

Guys i followed this tut :
https://sampforum.blast.hk/showthread.php?tid=162488

But i got those errors:
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(69) : error 017: undefined symbol "RandomSpawns"
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(69) : error 029: invalid expression, assumed zero
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(69) : warning 215: expression has no effect
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(70) : error 017: undefined symbol "RandomSpawns"
D:\Programmes\Engabic Blood Server\gamemodes\EABS.pwn(71) : error 017: undefined symbol "RandomSpawns"

Those are lines 69,70 and 71:
pawn Код:
new Random = random(sizeof(RandomSpawns));
        SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1],RandomSpawns[Random][2]);
        SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
Anyideas?
Reply
#2

Declare RandomSpawns array as global.

An example is shown here too: https://sampwiki.blast.hk/wiki/Random
Reply
#3

Sorry but,this is my first created gamemode,How to declare as global?and what actully to declear?
Reply
#4

The tutorial you linked explains it:

Quote:
Originally Posted by FUNExtreme
Посмотреть сообщение
pawn Код:
new Float:RandomSpawns[][] =
{
    {1249.7258, -2047.9263, 59.9209, 90.2055}, // Randomspawn
    {1241.2084, -2057.6521, 60.0190, 94.9352}, // Randomspawn
    {1241.0105, -2052.6873, 59.9975, 2.8144}, // Randomspawn
    {718.4906, -1477.3024, 5.4688, 357.9947}, // Randomspawn
    {722.3772, -1477.2856, 5.4688, 272.3814} // Randomspawn
};
Important: The array should be located outside any function!!
Reply
#5

You should to add this.

Код:
new Float:RandomSpawns[][] = 
{
	{YOUR COORDINATES}, // 
	{YOUR COORDINATES}, // 
	{YOUR COORDINATES}, // 
	{YOUR COORDINATES}, // 
	{YOUR COORDINATES} // 
};
Reply
#6

I am telling the truth,i followed the tut in everything,and again make everything as you both said....
Reply
#7

The array might be declared as global (outside of any function) but should also be located before the parts of code is used. So place it under the includes and definitions.

If you still cannot fix it, then post what you've done so far.
Reply
#8

Okay i done it,now i got it,It means to keep it out any function....

AND THE THING YOU BOTH DIDN't explain,is to put it under the includes -LOL Konstatninos Said that in last post-
So i have finally made that,now,How to Make some RandomSpawnPoints for a case (team) and for another case?
As i made a textdraw in the OnPlayerRequestClass for every case(team,some skins.)So,How to make RandomSpawnPoints for each case(team)?
Reply
#9

Let's say you have 2 teams, team A and team B. Declare 2 arrays with random spawn points, one for each team.
Then when you need to spawn the player, check if the player is in team A and choose a random spawn point from the first array. If the player is in team B, choose a random spawn point from the second array.
Reply
#10

So i make it like this:
new Float:RandomSpawns[][4] =
{ //some spawns
};
new Float:RandomSpawns[][4] =
{
};
(making it doubled)
and then,In the OnPlayerSpawn,I make it to check if the player is in case (asda),It spawns him at
RandomSpawns[Random][0], RandomSpawns[Random][1],RandomSpawns[Random][2]

that is cool but,what about the second case(team)? it will be same?
RandomSpawns[Random][0], RandomSpawns[Random][1],RandomSpawns[Random][2]
?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)