Team Spawning Issues
#1

I'm having some issues with my team spawns.

I'm trying to create a random spawn area for civilians, but not for police. The code I'm using is not working.

Here is my code.

http://pastebin.com/FztcXB4u


The error I'm getting is:

PHP код:
C:\Users\SpawnZ\Desktop\Pawno\gamemodes\c&r.pwn(656) : error 029invalid expressionassumed zero
C
:\Users\SpawnZ\Desktop\Pawno\gamemodes\c&r.pwn(656) : warning 215expression has no effect
C
:\Users\SpawnZ\Desktop\Pawno\gamemodes\c&r.pwn(656) : error 001expected token";"but found "if"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
2 Errors

Line 656 is the else if line.


Thanks!
Reply
#2

Quote:

public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == TEAM_CIVILIAN)
{
switch(random(4))
{
case 0:
{
SetPlayerPos(playerid,2079.7163 ,1340.2308, 10.8203);
}
case 1:
{
SetPlayerPos(playerid, 2081.4160, 1292.6072, 10.8203);
}
case 2:
{
SetPlayerPos(playerid, 2035.4103, 1293.5703, 10.8203);
}
case 3:
{
SetPlayerPos(playerid, 2020.4103, 1292.5703, 10.8203);
}
}
}
else if(gTeam[playerid] == TEAM_POLICE)
{
SetPlayerPos(playerid,2084.2632,1236.8361,10.8203) ;
}
// StopAudioStreamForPlayer(playerid);
}

here it is may be this will work

edit pastbin link:here it is
Reply
#3

It appears it did, can you explain what you did.
Reply
#4

Try this :

PHP код:
public OnPlayerSpawn(playerid)
{
    if(
gTeam[playerid] == TEAM_CIVILIAN)
    {
        switch(
random(4))
        {
            case 
0SetPlayerPos(playerid2079.7163 ,1340.230810.8203);
            case 
1SetPlayerPos(playerid2081.41601292.607210.8203);
            case 
2SetPlayerPos(playerid2035.41031293.570310.8203);
            case 
3SetPlayerPos(playerid2020.41031292.570310.8203);
        }
    }
    else if(
gTeam[playerid] == TEAM_POLICE)
        
SetPlayerPos(playerid,2084.2632,1236.8361,10.8203);
    
StopAudioStreamForPlayer(playerid);
    return 
1;

EDIT: Indentation fixed, my bad.
Reply
#5

PHP код:
public OnPlayerSpawn(playerid)
{
    if(
gTeam[playerid] == TEAM_CIVILIAN)
    {
        switch(
random(4))
        {
            case 
0:
            {
                
SetPlayerPos(playerid,2079.7163 ,1340.230810.8203);
            }
            case 
1:
            {
                
SetPlayerPos(playerid2081.41601292.607210.8203);
            }
            case 
2:
            {
                
SetPlayerPos(playerid2035.41031293.570310.8203);
            }
            case 
3:
            {
                
SetPlayerPos(playerid2020.41031292.570310.8203);
            }
        }
    }
    else if(
gTeam[playerid] == TEAM_POLICE)
    {
        
SetPlayerPos(playerid,2084.2632,1236.8361,10.8203);
    }
    
StopAudioStreamForPlayer(playerid);

Reply
#6

I didn't, just useless {}.
Reply
#7

you were returning else if inside if condition. you have to return else if out side if condition
Reply
#8

Look below:

PHP код:
public OnPlayerSpawn(playerid

    if(
gTeam[playerid] == TEAM_CIVILIAN
    { 
        switch(
random(4)) 
        { 
            case 
0
            { 
                
SetPlayerPos(playerid,2079.7163 ,1340.230810.8203); 
            } 
            case 
1
            { 
                
SetPlayerPos(playerid2081.41601292.607210.8203); 
            } 
            case 
2
            { 
                
SetPlayerPos(playerid2035.41031293.570310.8203); 
            } 
            case 
3
            { 
                
SetPlayerPos(playerid2020.41031292.570310.8203); 
            } 
        } 
    } 
    else if(
gTeam[playerid] == TEAM_POLICE
    { 
        
SetPlayerPos(playerid,2084.2632,1236.8361,10.8203); 
    } 
    
StopAudioStreamForPlayer(playerid); 

Reply
#9

Quote:
Originally Posted by Danyal
Посмотреть сообщение
you were returning else if inside if condition. you have to return else if out side if condition
Thanks so much, I see now!

I appreciate the help! All is working great.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)