Random Spawn Seperate Teams HELP -
tronikk - 03.08.2011
I've been trying to mod LVDM to have 4 teams which spawn randomly, but only in their set part of San Andraes. Whenever I try to compile I get errors which I have no idea how to solve. Any help would be appreciated. I have included a link to a Pastebin upload of my .pwn
http://pastebin.com/Cy3A1npY
Re: Random Spawn Seperate Teams HELP -
Calgon - 03.08.2011
What are the errors you get? Paste the error messages with the lines of code that the errors appear on.
Re: Random Spawn Seperate Teams HELP -
tronikk - 03.08.2011
C:\Users\Administrator\Desktop\LVDMod\lvdm.pwn(295 ) : error 017: undefined symbol "gAztecaSpawns"
C:\Users\Administrator\Desktop\LVDMod\lvdm.pwn(295 ) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\LVDMod\lvdm.pwn(295 ) : error 001: expected token: ";", but found "]"
C:\Users\Administrator\Desktop\LVDMod\lvdm.pwn(295 ) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\LVDMod\lvdm.pwn(295 ) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Re: Random Spawn Seperate Teams HELP -
Calgon - 03.08.2011
Replace this function with the code I've changed for you:
pawn Код:
public SetPlayerRandomSpawn(playerid)
{
if (iSpawnSet[playerid] == 1)
{
new rand = random(sizeof(gGrovePlayerSpawns));
SetPlayerPos(playerid, gGrovePlayerSpawns[rand][0], gGrovePlayerSpawns[rand][1], gGrovePlayerSpawns[rand][2]); // Warp the player
SetPlayerFacingAngle(playerid, 270.0);
}
else if (iSpawnSet[playerid] == 0)
{
new rand = random(sizeof(gAztecaPlayerSpawns));
SetPlayerPos(playerid, gAztecaPlayerSpawns[rand][0], gAztecaPlayerSpawns[rand][1], gAztecaPlayerSpawns[rand][2]); // Warp the player
SetPlayerFacingAngle(playerid, 270.0);
}
else if (iSpawnSet[playerid] == 2)
{
new rand = random(sizeof(gVagosPlayerSpawns));
SetPlayerPos(playerid, gVagosPlayerSpawns[rand][0], gVagosPlayerSpawns[rand][1], gVagosPlayerSpawns[rand][2]);
SetPlayerFacingAngle(playerid, 270.0);
}
else if (iSpawnSet[playerid] == 3)
{
new rand = random(sizeof(gCopPlayerSpawns));
SetPlayerPos(playerid, gCopPlayerSpawns[rand][0], gCopPlayerSpawns[rand][1], gCopPlayerSpawns[rand][2]);
}
return 1;
}
Variable/array names are
extremely sensitive, you seem to have mistyped the array names for the spawns, be a little more vigilant next time.
Re: Random Spawn Seperate Teams HELP -
tronikk - 03.08.2011
Thanks, never would have noticed. But when I select my Cop skin I am still spawned in a random SF position. When I choose a cop skin I'm supposed to spawn infront 1 of 3 random police stations. any idea whats going on?
Re: Random Spawn Seperate Teams HELP -
Calgon - 03.08.2011
You're relying on the 'iSpawnSet' array to determine which class a player selects, but you haven't ever set a value (at least within the code you gave us) for iSpawnSet, so it's always 0.
Use the 'OnPlayerClassRequest' callback to determine which class a player selects, then you can set a relevant value for 'iSpawnSet' from within that callback.
Re: Random Spawn Seperate Teams HELP -
tronikk - 03.08.2011
Thanks for the explanation but I have no idea how to do that. Is there any way you could edit the code for me? thanks for all your help.