Posts: 6,129
Threads: 36
Joined: Jan 2009
What are the errors you get? Paste the error messages with the lines of code that the errors appear on.
Posts: 7
Threads: 1
Joined: Aug 2011
Reputation:
0
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.
Posts: 6,129
Threads: 36
Joined: Jan 2009
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.
Posts: 7
Threads: 1
Joined: Aug 2011
Reputation:
0
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?
Posts: 6,129
Threads: 36
Joined: Jan 2009
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.
Posts: 7
Threads: 1
Joined: Aug 2011
Reputation:
0
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.