SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/03/2015, 05:05 AM   #1
nicholasramdhan
Big Clucker
 
nicholasramdhan's Avatar
 
Join Date: Nov 2013
Location: Orlando, FL
Posts: 101
Reputation: 6
Default OnPlayerRequestSpawn help along with PlayerClass

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 (c) 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];
__________________
Skype: nicholas.ramdhan01
[/CENTER]
nicholasramdhan is offline   Reply With Quote
Old 27/03/2015, 05:12 AM   #2
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 219
Reputation: 11
Default Re: OnPlayerRequestSpawn help along with PlayerClass

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
   }
}
Aly is offline   Reply With Quote
Old 27/03/2015, 05:14 AM   #3
nicholasramdhan
Big Clucker
 
nicholasramdhan's Avatar
 
Join Date: Nov 2013
Location: Orlando, FL
Posts: 101
Reputation: 6
Default Re: OnPlayerRequestSpawn help along with PlayerClass

This is the switch:

Code:
    PlayerInfo[playerid][ pClassID ] = classid;
    switch(classid)
    {
__________________
Skype: nicholas.ramdhan01
[/CENTER]
nicholasramdhan is offline   Reply With Quote
Old 27/03/2015, 05:22 AM   #4
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 219
Reputation: 11
Default Re: OnPlayerRequestSpawn help along with PlayerClass

And where does it ends ? I can't see the bracket("}") that closes the switch.
Aly is offline   Reply With Quote
Old 27/03/2015, 05:25 AM   #5
nicholasramdhan
Big Clucker
 
nicholasramdhan's Avatar
 
Join Date: Nov 2013
Location: Orlando, FL
Posts: 101
Reputation: 6
Default Re: OnPlayerRequestSpawn help along with PlayerClass

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;
}
__________________
Skype: nicholas.ramdhan01
[/CENTER]
nicholasramdhan is offline   Reply With Quote
Old 27/03/2015, 05:27 AM   #6
Aly
Huge Clucker
 
Join Date: Oct 2012
Posts: 219
Reputation: 11
Default Re: OnPlayerRequestSpawn help along with PlayerClass

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;
}
Aly is offline   Reply With Quote
Old 27/03/2015, 05:34 AM   #7
nicholasramdhan
Big Clucker
 
nicholasramdhan's Avatar
 
Join Date: Nov 2013
Location: Orlando, FL
Posts: 101
Reputation: 6
Default Re: OnPlayerRequestSpawn help along with PlayerClass

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;
}
__________________
Skype: nicholas.ramdhan01
[/CENTER]
nicholasramdhan is offline   Reply With Quote
Old 27/03/2015, 06:02 AM   #8
CalvinC
High-roller
 
CalvinC's Avatar
 
Join Date: Nov 2014
Location: Denmark
Posts: 1,830
Reputation: 114
Default Re: OnPlayerRequestSpawn help along with PlayerClass

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;
}
http://wiki.sa-mp.com/wiki/Errors_Li...se_indentation
__________________
[Tutorial] Custom Playerdamage system
Desert Eagle's dealing too much damage, you want one-hit sniper kills, or damage based on body parts? Check this out.
CalvinC is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[help]Team PlayerClass Selection help jeffery30162 Scripting Help 13 06/09/2012 06:14 AM
quick playerclass help. Mark_Weston Help Archive 11 07/07/2011 12:47 AM
Plz Help Me With PlayerClass{Problem Not Solved} Keeboo13 Help Archive 4 23/02/2010 01:34 AM
PlayerClass bubka3 Help Archive 1 18/08/2009 03:11 AM
Restrict Playerclass to Rank Adamrcook Help Archive 1 28/07/2009 04:55 AM


All times are GMT. The time now is 06:47 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.