Spawn location changing.
#1

EDIT: I got it to work, if anyone needs to know how just reply to this topic.





Hey,

I'm making a script to rotate spawn locations from one set of randoms ones to another set of random ones, here's what I wrote:

Код:
public OnPlayerSpawn(playerid)
{
    ShowPlayerDialog(playerid, 3, 2, "Which arena do you want to join ?", "Walking Weapons.", "Running Weapons.", "Play!");
    CallRemoteFunction("NewMap", "i", playerid); //or just NewMap(); ?
	return 1;
}
And :

Код:
new Float:SpawnLVA[][]=
	{
	    {1651.1795, 1543.3081, 14.6334, 0.0000},
	    {1623.3718, 1536.6872, 14.6334, 0.0000},
	    {1635.2894, 1581.7091, 14.6334, 270.0000},
	    {1591.5916, 1624.0827, 14.6334, 180.0000},
	    {1701.4981, 1673.0771, 14.6334, 180.0000},
	    {1701.4981, 1577.7366, 14.6334, 90.0000},
	    {1718.7124, 1634.6761, 14.6334, 0.0000},
	};


new MapID = 0;


forward NewMap(playerid);
public NewMap(playerid)
{

	switch (MapID)
	{
		case 0:
		{
		    for (new i=0, i < MAX_PLAYERS; i++)
			{
			    if(IsPlayerConnected(i))
					new RandomSpawn = random(sizeof(SpawnLVA));
					SetPlayerPos(i, SpawnLVA[RandomSpawn][0], SpawnLVA[RandomSpawn][1], SpawnLVA[RandomSpawn][2])
					SetPlayerFacingAngle(i, SpawnLVA[RandomSpawn][4]);
					MapID ++;
					SetTimerEx("NewMap", 600000, 0, "d", playerid);
			}
		}
		case 1:
		{
		    for (new i=0, i < MAX_PLAYERS; i++) 
			{
			    if(IsPlayerConnected(i))
					new RandomSpawn = random(sizeof(SpawnLVA));
					SetPlayerPos(i, SpawnLVA[RandomSpawn][0], SpawnLVA[RandomSpawn][1], SpawnLVA[RandomSpawn][2]) // It's the same spawn Float since I haven't added the other spawn floats yet but it should still work.
					SetPlayerFacingAngle(i, SpawnLVA[RandomSpawn][4]);
					MapID ++;
					SetTimerEx("NewMap", 600000, 0, "d", playerid);
			}
		}
		case 2:
		{
		    for (new i=0, i < MAX_PLAYERS; i++)
			{
			    if(IsPlayerConnected(i))
					new RandomSpawn = random(sizeof(SpawnLVA));
					SetPlayerPos(i, SpawnLVA[RandomSpawn][0], SpawnLVA[RandomSpawn][1], SpawnLVA[RandomSpawn][2]) // It's the same spawn Float since I haven't added the other spawn floats yet but it should still work.
					SetPlayerFacingAngle(i, SpawnLVA[RandomSpawn][4]);
					MapID =0;
					SetTimerEx("NewMap", 600000, 0, "d", playerid);
			}
		
		}
	}

}
The only errors I get in my script are from these lines and I can't seem to get around them:


Код:
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(30) : warning 217: loose indentation
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(564) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(568) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(579) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(580) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(601) : error 029: invalid expression, assumed zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(601) : error 008: must be a constant expression; assumed zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(615) : error 021: symbol already defined: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(615) : warning 206: redundant test: constant expression is non-zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(618) : error 003: declaration of a local variable must appear in a compound block
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(618) : warning 217: loose indentation
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(618) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(619) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(620) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(615) : warning 204: symbol is assigned a value that is never used: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(627) : error 021: symbol already defined: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(627) : warning 206: redundant test: constant expression is non-zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(630) : error 003: declaration of a local variable must appear in a compound block
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(630) : warning 217: loose indentation
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(630) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(631) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(632) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(627) : warning 204: symbol is assigned a value that is never used: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(639) : error 021: symbol already defined: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(639) : warning 206: redundant test: constant expression is non-zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(642) : error 003: declaration of a local variable must appear in a compound block
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(642) : warning 217: loose indentation
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(642) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(643) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(644) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(639) : warning 204: symbol is assigned a value that is never used: "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


17 Errors.
It would be nice if someone could guide me to finding the solution, thank you very much.
I hope I am not asking too much.
Reply
#2

Try this one :

PHP код:
public OnPlayerSpawn(playerid)
{
    
ShowPlayerDialog(playerid32"Which arena do you want to join ?""Walking Weapons.""Running Weapons.""Play!");
    
NewMap();
    return 
1;

Reply
#3

This is what I get :

Код:
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(30) : warning 217: loose indentation
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(304) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(564) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(568) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(579) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(580) : warning 202: number of arguments does not match definition
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(601) : error 029: invalid expression, assumed zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(601) : error 008: must be a constant expression; assumed zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(615) : error 021: symbol already defined: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(615) : warning 206: redundant test: constant expression is non-zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(618) : error 003: declaration of a local variable must appear in a compound block
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(618) : warning 217: loose indentation
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(618) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(619) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(620) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(615) : warning 204: symbol is assigned a value that is never used: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(627) : error 021: symbol already defined: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(627) : warning 206: redundant test: constant expression is non-zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(630) : error 003: declaration of a local variable must appear in a compound block
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(630) : warning 217: loose indentation
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(630) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(631) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(632) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(627) : warning 204: symbol is assigned a value that is never used: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(639) : error 021: symbol already defined: "i"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(639) : warning 206: redundant test: constant expression is non-zero
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(642) : error 003: declaration of a local variable must appear in a compound block
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(642) : warning 217: loose indentation
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(642) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(643) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(644) : error 017: undefined symbol "RandomSpawn"
C:\Users\USer\Desktop\My Files\Games\GTA SA\Scripting\gamemodes\LoftyScript.pwn(639) : warning 204: symbol is assigned a value that is never used: "i"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


17 Errors.
:/ Any other suggestions ?

I believe the problem is mainly with the NewMap function.
Reply
#4

EDIT: I got it to work, if anyone needs to know how just reply to this topic.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)