OnPlayerRequestSpawn help along with PlayerClass
#1

C:\Users\Nicholas\Desktop\GWDM\gamemodes\GWDM.pwn( 844) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Nicholas\Desktop\GWDM\gamemodes\GWDM.pwn( 844) : warning 215: expression has no effect
C:\Users\Nicholas\Desktop\GWDM\gamemodes\GWDM.pwn( 845) : warning 209: function "OnPlayerRequestClass" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Well, here.
Line 816 - 850:

Code:
       case 32..35: {
		 new name[ MAX_PLAYER_NAME ];
		 SetPlayerPos(playerid,2752.8835,-2513.6389,25.7914);
         SetPlayerCameraPos(playerid,2753.1050,-2519.0244,26.6926);
         SetPlayerCameraLookAt(playerid,2752.8835,-2513.6389,25.7914);
         SetPlayerFacingAngle(playerid,180.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~[RESTRICTED] Men In Black", 3000, 3);
         ApplyAnimation(playerid,"GYMNASIUM", "GYMshadowbox",4.0,1,1,1,1,1);
         if(strfind(name,"[MiB]",true) != -1)
		 {
			 SendClientMessage(playerid, HOODLUMS_COLOR, "You have spawned as a official Men In Black clan member.");
			 return 1;
		 }
       }
       case 36..39: {
		 new name[ MAX_PLAYER_NAME ];
		 SetPlayerPos(playerid,1262.5465,-1260.1057,13.2015);
         SetPlayerCameraPos(playerid,1265.7855,-1262.5286,13.2771);
         SetPlayerCameraLookAt(playerid,1262.5465,-1260.1057,13.2015);
         SetPlayerFacingAngle( playerid,230.0 );
         GameTextForPlayer( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~[RESTRICTED] Double X Factors", 3000, 3 );
         ApplyAnimation( playerid, "STRIP", "PUN_HOLLER", 4.0, 1, 1, 1, 1, 1 );
         if(strfind(name,"[X_X]",true) != -1)
		 {
			 SendClientMessage(playerid, WORKERS_COLOR, "You have spawned as an official X Factors clan member.");
			 return 0;
			}
		}
    	return 1;
}
//==============================================================================

public OnPlayerRequestSpawn(playerid)
{
    new Name[MAX_PLAYER_NAME], string[256];
Reply
#2

I guess you forgot to close "switch",because i can't see the bracket that closes that.
Code:
switch(something)
{
   case 1:
   {
       //Some Code here
   }
   case 2:
   {
       //Some Code here
   }
}
Reply
#3

This is the switch:

Code:
    PlayerInfo[playerid][ pClassID ] = classid;
    switch(classid)
    {
Reply
#4

And where does it ends ? I can't see the bracket("}") that closes the switch.
Reply
#5

Here, this is the whole OnPlayerRequestClass line.

Code:
public OnPlayerRequestClass( playerid, classid )
{
    SetPlayerColor( playerid, COLOR_INACTIVE );
    PlayerPlaySound( playerid, 1068, 0.0, 0.0, 0.0 );
    
    PlayerInfo[playerid][ pClassID ] = classid;
    switch(classid)
    {
       case 0..3: {
		 SetPlayerPos(playerid,1810.5295,-2103.0408,13.5469);
         SetPlayerCameraPos(playerid,1814.3398,-2100.5222,13.5469);
         SetPlayerCameraLookAt(playerid,1810.5295,-2103.0408,13.5469);
         SetPlayerFacingAngle(playerid,300.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Aztecas", 3000, 3);
         ApplyAnimation(playerid,"RIOT", "RIOT_ANGRY",4.0,1,1,1,1,1);
       }
       case 4..7: {
         SetPlayerPos(playerid,2654.5081,-1063.5448,69.5937);
         SetPlayerCameraPos(playerid,2658.3940,-1060.7126,69.5209);
         SetPlayerCameraLookAt(playerid,2654.5081,-1063.5448,69.5937);
         SetPlayerFacingAngle(playerid,300.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Vagos", 3000, 3);
         ApplyAnimation(playerid,"RIOT", "RIOT_CHANT",4.0,1,1,1,1,1);
       }
       case 8..11: {
         SetPlayerPos(playerid,1979.8929,-1143.1704,25.9858);
         SetPlayerCameraPos(playerid,1975.8948,-1145.9689,25.9895);
         SetPlayerCameraLookAt(playerid,1979.8929,-1143.1704,25.9858);
         SetPlayerFacingAngle(playerid,120.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
         ApplyAnimation(playerid,"GHANDS", "gsign2LH",4.0,1,1,1,1,1);
       }
       case 12..15: {
         SetPlayerPos(playerid,2498.2249,-1644.6326,18.8751);
         SetPlayerCameraPos(playerid,2498.2676,-1640.1935,18.6116);
         SetPlayerCameraLookAt(playerid,2498.2249,-1644.6326,18.8751);
         SetPlayerFacingAngle(playerid,0.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Grove Street", 3000, 3);
         ApplyAnimation(playerid,"LOWRIDER", "RAP_B_Loop",4.0,1,1,1,1,1);
       }
       case 16..19: {
         SetPlayerPos(playerid,2785.7817,-1956.1940,20.4537);
         SetPlayerCameraPos(playerid,2791.5693,-1956.3384,21.3124);
         SetPlayerCameraLookAt(playerid,2785.7817,-1956.1940,20.4537);
         SetPlayerFacingAngle(playerid,270.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Mafia", 3000, 3);
         ApplyAnimation(playerid,"DEALER", "DEALER_IDLE",4.0,1,1,1,1,1);
       }
       case 20..23: {
         SetPlayerPos(playerid,1524.5602,-1581.9534,23.5469);
         SetPlayerCameraPos(playerid,1524.6063,-1577.8397,23.5469);
         SetPlayerCameraLookAt(playerid,1524.5602,-1581.9534,23.5469);
         SetPlayerFacingAngle(playerid,0.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Cops", 3000, 3);
         ApplyAnimation(playerid,"ped", "ARRESTgun", 4.0, 0, 1, 1, 1, -1);
       }
       case 24..27: {
         SetPlayerPos(playerid,953.6748,-1696.7352,20.3672);
         SetPlayerCameraPos(playerid,958.7288,-1701.0875,20.9513);
         SetPlayerCameraLookAt(playerid,953.6748,-1696.7352,20.3672);
         SetPlayerFacingAngle(playerid,225.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Bikers", 3000, 3);
         ApplyAnimation(playerid,"GANGS", "Invite_Yes",4.0,1,1,1,1,1);
       }
       case 28..31: {
         SetPlayerPos(playerid,1288.2465,-800.1273,96.4609);
         SetPlayerCameraPos(playerid,1285.2930,-795.5814,96.4609);
         SetPlayerCameraLookAt(playerid,1288.2465,-800.1273,96.4609);
         SetPlayerFacingAngle(playerid,20.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Hobos", 3000, 3);
         ApplyAnimation(playerid,"LOWRIDER", "RAP_A_Loop",4.0,1,1,1,1,1);
       }
       case 32..35: {
		 new name[ MAX_PLAYER_NAME ];
		 SetPlayerPos(playerid,2752.8835,-2513.6389,25.7914);
         SetPlayerCameraPos(playerid,2753.1050,-2519.0244,26.6926);
         SetPlayerCameraLookAt(playerid,2752.8835,-2513.6389,25.7914);
         SetPlayerFacingAngle(playerid,180.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~[RESTRICTED] Men In Black", 3000, 3);
         ApplyAnimation(playerid,"GYMNASIUM", "GYMshadowbox",4.0,1,1,1,1,1);
         if(strfind(name,"[MiB]",true) != -1)
		 {
			 SendClientMessage(playerid, HOODLUMS_COLOR, "You have spawned as a official Men In Black clan member.");
			 return 1;
		 }
       }
       case 36..39: {
		 new name[ MAX_PLAYER_NAME ];
		 SetPlayerPos(playerid,1262.5465,-1260.1057,13.2015);
         SetPlayerCameraPos(playerid,1265.7855,-1262.5286,13.2771);
         SetPlayerCameraLookAt(playerid,1262.5465,-1260.1057,13.2015);
         SetPlayerFacingAngle( playerid,230.0 );
         GameTextForPlayer( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~[RESTRICTED] Double X Factors", 3000, 3 );
         ApplyAnimation( playerid, "STRIP", "PUN_HOLLER", 4.0, 1, 1, 1, 1, 1 );
         if(strfind(name,"[X_X]",true) != -1)
		 {
			 SendClientMessage(playerid, WORKERS_COLOR, "You have spawned as an official X Factors clan member.");
			 return 0;
			}
		}
    	return 1;
}
Reply
#6

Try this:
Code:
public OnPlayerRequestClass( playerid, classid )
{
    SetPlayerColor( playerid, COLOR_INACTIVE );
    PlayerPlaySound( playerid, 1068, 0.0, 0.0, 0.0 );
    
    PlayerInfo[playerid][ pClassID ] = classid;
    switch(classid)
    {
       case 0..3: {
		 SetPlayerPos(playerid,1810.5295,-2103.0408,13.5469);
         SetPlayerCameraPos(playerid,1814.3398,-2100.5222,13.5469);
         SetPlayerCameraLookAt(playerid,1810.5295,-2103.0408,13.5469);
         SetPlayerFacingAngle(playerid,300.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Aztecas", 3000, 3);
         ApplyAnimation(playerid,"RIOT", "RIOT_ANGRY",4.0,1,1,1,1,1);
       }
       case 4..7: {
         SetPlayerPos(playerid,2654.5081,-1063.5448,69.5937);
         SetPlayerCameraPos(playerid,2658.3940,-1060.7126,69.5209);
         SetPlayerCameraLookAt(playerid,2654.5081,-1063.5448,69.5937);
         SetPlayerFacingAngle(playerid,300.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Vagos", 3000, 3);
         ApplyAnimation(playerid,"RIOT", "RIOT_CHANT",4.0,1,1,1,1,1);
       }
       case 8..11: {
         SetPlayerPos(playerid,1979.8929,-1143.1704,25.9858);
         SetPlayerCameraPos(playerid,1975.8948,-1145.9689,25.9895);
         SetPlayerCameraLookAt(playerid,1979.8929,-1143.1704,25.9858);
         SetPlayerFacingAngle(playerid,120.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Ballas", 3000, 3);
         ApplyAnimation(playerid,"GHANDS", "gsign2LH",4.0,1,1,1,1,1);
       }
       case 12..15: {
         SetPlayerPos(playerid,2498.2249,-1644.6326,18.8751);
         SetPlayerCameraPos(playerid,2498.2676,-1640.1935,18.6116);
         SetPlayerCameraLookAt(playerid,2498.2249,-1644.6326,18.8751);
         SetPlayerFacingAngle(playerid,0.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Grove Street", 3000, 3);
         ApplyAnimation(playerid,"LOWRIDER", "RAP_B_Loop",4.0,1,1,1,1,1);
       }
       case 16..19: {
         SetPlayerPos(playerid,2785.7817,-1956.1940,20.4537);
         SetPlayerCameraPos(playerid,2791.5693,-1956.3384,21.3124);
         SetPlayerCameraLookAt(playerid,2785.7817,-1956.1940,20.4537);
         SetPlayerFacingAngle(playerid,270.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Mafia", 3000, 3);
         ApplyAnimation(playerid,"DEALER", "DEALER_IDLE",4.0,1,1,1,1,1);
       }
       case 20..23: {
         SetPlayerPos(playerid,1524.5602,-1581.9534,23.5469);
         SetPlayerCameraPos(playerid,1524.6063,-1577.8397,23.5469);
         SetPlayerCameraLookAt(playerid,1524.5602,-1581.9534,23.5469);
         SetPlayerFacingAngle(playerid,0.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Cops", 3000, 3);
         ApplyAnimation(playerid,"ped", "ARRESTgun", 4.0, 0, 1, 1, 1, -1);
       }
       case 24..27: {
         SetPlayerPos(playerid,953.6748,-1696.7352,20.3672);
         SetPlayerCameraPos(playerid,958.7288,-1701.0875,20.9513);
         SetPlayerCameraLookAt(playerid,953.6748,-1696.7352,20.3672);
         SetPlayerFacingAngle(playerid,225.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Bikers", 3000, 3);
         ApplyAnimation(playerid,"GANGS", "Invite_Yes",4.0,1,1,1,1,1);
       }
       case 28..31: {
         SetPlayerPos(playerid,1288.2465,-800.1273,96.4609);
         SetPlayerCameraPos(playerid,1285.2930,-795.5814,96.4609);
         SetPlayerCameraLookAt(playerid,1288.2465,-800.1273,96.4609);
         SetPlayerFacingAngle(playerid,20.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~Hobos", 3000, 3);
         ApplyAnimation(playerid,"LOWRIDER", "RAP_A_Loop",4.0,1,1,1,1,1);
       }
       case 32..35: {
		 new name[ MAX_PLAYER_NAME ];
		 SetPlayerPos(playerid,2752.8835,-2513.6389,25.7914);
         SetPlayerCameraPos(playerid,2753.1050,-2519.0244,26.6926);
         SetPlayerCameraLookAt(playerid,2752.8835,-2513.6389,25.7914);
         SetPlayerFacingAngle(playerid,180.0);
		 GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~[RESTRICTED] Men In Black", 3000, 3);
         ApplyAnimation(playerid,"GYMNASIUM", "GYMshadowbox",4.0,1,1,1,1,1);
         if(strfind(name,"[MiB]",true) != -1)
		 {
			 SendClientMessage(playerid, HOODLUMS_COLOR, "You have spawned as a official Men In Black clan member.");
			 return 1;
		 }
       }
       case 36..39: {
		 new name[ MAX_PLAYER_NAME ];
		 SetPlayerPos(playerid,1262.5465,-1260.1057,13.2015);
         SetPlayerCameraPos(playerid,1265.7855,-1262.5286,13.2771);
         SetPlayerCameraLookAt(playerid,1262.5465,-1260.1057,13.2015);
         SetPlayerFacingAngle( playerid,230.0 );
         GameTextForPlayer( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~[RESTRICTED] Double X Factors", 3000, 3 );
         ApplyAnimation( playerid, "STRIP", "PUN_HOLLER", 4.0, 1, 1, 1, 1, 1 );
         if(strfind(name,"[X_X]",true) != -1)
		 {
			 SendClientMessage(playerid, WORKERS_COLOR, "You have spawned as an official X Factors clan member.");
			 return 0;
			}
		}
        }
    	return 1;
}
Reply
#7

Okay thanks. You fixed the error, but I got a warning for loose indentation lol. I know it's not a big deal but idk how to fix it and I don't like warnings lol.

C:\Users\Nicholas\Desktop\GWDM\gamemodes\GWDM.pwn( 845) : warning 217: loose indentation

Line 841-846:

Code:
			 return 0;
			}
		}
        }
    	return 1;
}
Reply
#8

And shouldn't you use return 1 here?
pawn Code:
case 36..39:
    {
        new name[ MAX_PLAYER_NAME ];
        SetPlayerPos(playerid,1262.5465,-1260.1057,13.2015);
        SetPlayerCameraPos(playerid,1265.7855,-1262.5286,13.2771);
        SetPlayerCameraLookAt(playerid,1262.5465,-1260.1057,13.2015);
        SetPlayerFacingAngle( playerid,230.0 );
        GameTextForPlayer( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~[RESTRICTED] Double X Factors", 3000, 3 );
        ApplyAnimation( playerid, "STRIP", "PUN_HOLLER", 4.0, 1, 1, 1, 1, 1 );
        if(strfind(name,"[X_X]",true) != -1)
        {
            SendClientMessage(playerid, WORKERS_COLOR, "You have spawned as an official X Factors clan member.");
            return 0; // here
        }
    }
Otherwise you're telling them they spawned as an official X factor clan, but you disallow them to switch to that class by using return 0?

EDIT:
For correct indentation do this:
pawn Code:
return 0;
            }
        }
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/Errors_Li...se_indentation
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)