please help on map changer system(don't ignore this please)
#1

Hello i have that error and warning i want my script clear so here is everything
Код:
error 002(730): only a single statement (or expression) can follow each "case"
(730) : warning 215: expression has no effect
Код:
switch ( MapChange  ) {                        
	case 0:                                   
        {
            SetPlayerPos(playerid, 1477.5083, -68.5836,23.2060);
            SetPlayerFacingAngle(playerid, 1477.5083);
        }
        case 1:                                   
        {
            SetPlayerPos(playerid,1885.1696,-2994.2351,2.5060);
            SetPlayerFacingAngle(playerid,1885.1696);
        }
        case 2:                                   
        {
	    SetPlayerPos(playerid,3.3,352.39999,7.5);
            SetPlayerFacingAngle(playerid,3.3);
        }
        case 3:
	{
	    SetPlayerPos(playerid,468.5,-2930.8999,14.7);
	    SetPlayerFacingAngle(playerid,468.5);
	    
        }

return 1;
}
LINE 30 is the "return 1;"
Reply
#2

remove return 1;
Reply
#3

kiding me?
look at the code carfully :3 i fixed the copying
Reply
#4

Quote:
Originally Posted by MarkNelson
Посмотреть сообщение
kiding me?
look at the code carfully :3 i fixed the copying
https://sampwiki.blast.hk/wiki/Control_Structures#switch_2

PHP код:
switch ( MapChange  ) {                        
    case 
0:                                   
        {
            
SetPlayerPos(playerid1477.5083, -68.5836,23.2060);
            
SetPlayerFacingAngle(playerid1477.5083);
        }
        case 
1:                                   
        {
            
SetPlayerPos(playerid,1885.1696,-2994.2351,2.5060);
            
SetPlayerFacingAngle(playerid,1885.1696);
        }
        case 
2:                                   
        {
        
SetPlayerPos(playerid,3.3,352.39999,7.5);
            
SetPlayerFacingAngle(playerid,3.3);
        }
        case 
3:
    {
        
SetPlayerPos(playerid,468.5,-2930.8999,14.7);
        
SetPlayerFacingAngle(playerid,468.5);
        
      }
        return 
1//<-- error

Reply
#5

it's in "OnPlayerSpawn" so how to end that function :3
i got much errors when i deleted them
plus it's GM not FS
Reply
#6

Hello!

Show us your whole OnPlayerSpawn. Normally you shouldn't get more errors.
Reply
#7

PHP код:
public OnPlayerSpawn(playerid){
    switch(
MapChange){
        case 
0: {
            
SetPlayerPos(playerid1477.5083, -68.5836,23.2060);
            
SetPlayerFacingAngle(playerid1477.5083);
        }
        case 
1: {
            
SetPlayerPos(playerid,1885.1696,-2994.2351,2.5060);
            
SetPlayerFacingAngle(playerid,1885.1696);
        }
        case 
2: {
            
SetPlayerPos(playerid,3.3,352.39999,7.5);
            
SetPlayerFacingAngle(playerid,3.3);
        }
        case 
3: {
            
SetPlayerPos(playerid,468.5,-2930.8999,14.7);
            
SetPlayerFacingAngle(playerid,468.5);
        }
    }

    return 
1;

Reply
#8

Код:
public OnPlayerSpawn(playerid)
{
    new Random = random(sizeof(RandomSpawns));
	SetPlayerInterior(playerid,5);
	SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
	new RandomTeam = random(3);
	gPlayerTeam[playerid] = RandomTeams[RandomTeam][0];
	
	if(gPlayerTeam[playerid] == 0)
	{
	    TextDrawSetString(Textdraw2, "Alive");
	    SendClientMessage(playerid,COLOR_RED,"You're the murderer, be quiet and kill the other players ! Try to not be spotted by the Deagle");
	    GivePlayerWeapon(playerid,4,1);
	}
	
	if(gPlayerTeam[playerid] == 1)
	{
	    TextDrawSetString(Textdraw4, "Alive");
	    SendClientMessage(playerid,COLOR_YELLOW,"You're the Deagle, find the murderer and kill him !");
	    GivePlayerWeapon(playerid,24,200);
	}
	
	if(gPlayerTeam[playerid] == 2)
	{
	    SendClientMessage(playerid,-1,"You're the civilian, get away from the murderer ");
	}

	SetPlayerHealth(playerid,20.0);
	SetPlayerWeather(playerid,20);
	

    switch ( MapChange  ) {                        
		case 0:                                   
        {
            SetPlayerPos(playerid, 1477.5083, -68.5836,23.2060);
            SetPlayerFacingAngle(playerid, 1477.5083);
        }
        case 1:                                   
        {
            SetPlayerPos(playerid,1885.1696,-2994.2351,2.5060);
            SetPlayerFacingAngle(playerid,1885.1696);
        }
        case 2:                                   
        {
	    SetPlayerPos(playerid,3.3,352.39999,7.5);
	    SetPlayerFacingAngle(playerid,3.3);
        }
        case 3:
	{
			SetPlayerPos(playerid,468.5,-2930.8999,14.7);
			SetPlayerFacingAngle(playerid,468.5);
	        }

	return 1;
}
Reply
#9

Thanks very much Abyss it's fixed and works thanks , thanks very much all
Reply
#10

Do it like this. You forgot a bracket.
PHP код:
public OnPlayerSpawn(playerid)
{
    new 
Random random(sizeof(RandomSpawns));
    
SetPlayerInterior(playerid,5);
    
SetPlayerPos(playeridRandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    new 
RandomTeam random(3);
    
gPlayerTeam[playerid] = RandomTeams[RandomTeam][0];
    if(
gPlayerTeam[playerid] == 0)
    {
        
TextDrawSetString(Textdraw2"Alive");
        
SendClientMessage(playerid,COLOR_RED,"You're the murderer, be quiet and kill the other players ! Try to not be spotted by the Deagle");
        
GivePlayerWeapon(playerid,4,1);
    }
    if(
gPlayerTeam[playerid] == 1)
    {
        
TextDrawSetString(Textdraw4"Alive");
        
SendClientMessage(playerid,COLOR_YELLOW,"You're the Deagle, find the murderer and kill him !");
        
GivePlayerWeapon(playerid,24,200);
    }
    if(
gPlayerTeam[playerid] == 2)
    {
        
SendClientMessage(playerid,-1,"You're the civilian, get away from the murderer ");
    }
    
SetPlayerHealth(playerid,20.0);
    
SetPlayerWeather(playerid,20);
    switch ( 
MapChange  ) {
        case 
0:
        {
            
SetPlayerPos(playerid1477.5083, -68.5836,23.2060);
            
SetPlayerFacingAngle(playerid1477.5083);
        }
        case 
1:
        {
            
SetPlayerPos(playerid,1885.1696,-2994.2351,2.5060);
            
SetPlayerFacingAngle(playerid,1885.1696);
        }
        case 
2:
        {
        
SetPlayerPos(playerid,3.3,352.39999,7.5);
        
SetPlayerFacingAngle(playerid,3.3);
        }
        case 
3:
        {
            
SetPlayerPos(playerid,468.5,-2930.8999,14.7);
            
SetPlayerFacingAngle(playerid,468.5);
           }
       }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)