Brackets
#1

Well..First of All - Hello Everybody , I Am new to Scripting and i really want to learn , Anyway..

I made this Code :

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerInterior(playerid,0);
    
SetPlayerPosplayerid1455.2064, -785.192399.8605 );
    
SetPlayerFacingAngleplayerid139.1213 );
    
SetPlayerCameraPosplayerid1453.343, -787.109100.860 );
    
SetPlayerCameraLookAtplayerid1455.2064, -785.192399.8605 );
    
ApplyAnimationplayerid"DANCING""DNCE_M_B"4.01000, -);
    
PlayerPlaySoundplayerid1097, -119.946023.109612.2238 );

I want to add this to it :

PHP код:
public OnPlayerRequestClassplayeridclassid //  This is called when a player is on class selection
{    
switch ( 
classid // This is like a if/elseif statement.   
 
{        
case 
0// If the classid is 0        
// Then            
GameTextForPlayerplayerid"~r~TEAM Ballas"300);            // Sends a gametext for player            // ~r~ is a red color in gametext.            // Arguments : Player ID, const string[ ], time ( milliseconds ), style             // Wiki for more info            
SetPlayerTeamplayeridTEAM_BALLAS ); // Sets the player's team to TEAM_BALLAS       
 
}        
case 
1// If the classid is 1        
// Then            
GameTextForPlayerplayerid"~g~TEAM CJ"300);            // Sends a gametext for player            // ~g~ is a green color in gametext.            // Arguments : Player ID, const string[ ], time ( milliseconds ), style             // Wiki for more info            
SetPlayerTeamplayeridTEAM_CJ ); // Sets the player's team to TEAM_CJ        }        
case 2// If the classid is 2       
 
// Then            
GameTextForPlayerplayerid"~g~TEAM CJ"300);            // Sends a gametext for player            // ~g~ is a green color in gametext.            // Arguments : Player ID, const string[ ], time ( milliseconds ), style             // Wiki for more info            
SetPlayerTeamplayeridTEAM_CJ ); // Sets the player's team to TEAM_CJ        
}    
}        
return 
1// This means the callback is executed succesfully AFAIK.} 
- Any Help would be Appreciated And i really want to know how to open the bracket again under PlayerPlaySound to add those
Reply
#2

I don't understand it: maybe this can help? https://sampwiki.blast.hk/wiki/PlayerPlaySound
Reply
#3

Well , Not Really - That's not what i am asking about , The 2 Codes i Posted above - I Want to mix them..I Mean to put the BOTH codes under OnPlayerRequestClass - So how to a new Bracket after this

PHP код:
    PlayerPlaySoundplayerid1097, -119.946023.109612.2238 ); 

and add this under it :

PHP код:
{     
switch ( 
classid // This is like a if/elseif statement.    
 
{         
case 
0// If the classid is 0         
// Then             
GameTextForPlayerplayerid"~r~TEAM Ballas"300);            // Sends a gametext for player            // ~r~ is a red color in gametext.            // Arguments : Player ID, const string[ ], time ( milliseconds ), style             // Wiki for more info             
SetPlayerTeamplayeridTEAM_BALLAS ); // Sets the player's team to TEAM_BALLAS        
 
}         
case 
1// If the classid is 1         
// Then             
GameTextForPlayerplayerid"~g~TEAM CJ"300);            // Sends a gametext for player            // ~g~ is a green color in gametext.            // Arguments : Player ID, const string[ ], time ( milliseconds ), style             // Wiki for more info             
SetPlayerTeamplayeridTEAM_CJ ); // Sets the player's team to TEAM_CJ        }         
case 2// If the classid is 2        
 
// Then             
GameTextForPlayerplayerid"~g~TEAM CJ"300);            // Sends a gametext for player            // ~g~ is a green color in gametext.            // Arguments : Player ID, const string[ ], time ( milliseconds ), style             // Wiki for more info             
SetPlayerTeamplayeridTEAM_CJ ); // Sets the player's team to TEAM_CJ         
}     
}         
return 
1// This means the callback is executed succesfully AFAIK.} 
Reply
#4

pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    SetPlayerInterior(playerid,0);
    SetPlayerPos( playerid, 1455.2064, -785.1923, 99.8605 );
    SetPlayerFacingAngle( playerid, 139.1213 );
    SetPlayerCameraPos( playerid, 1453.343, -787.109, 100.860 );
    SetPlayerCameraLookAt( playerid, 1455.2064, -785.1923, 99.8605 );
    ApplyAnimation( playerid, "DANCING", "DNCE_M_B", 4.0, 1, 0, 0, 0, -1 );
    PlayerPlaySound( playerid, 1097, -119.9460, 23.1096, 12.2238 );

    switch ( classid )
    {        
        case 0:
        {  
            GameTextForPlayer( playerid, "~r~TEAM Ballas", 300, 3 );        
            SetPlayerTeam( playerid, TEAM_BALLAS );
        }        
        case 1:      
        {  
            GameTextForPlayer( playerid, "~g~TEAM CJ", 300, 3 );
            SetPlayerTeam( playerid, TEAM_CJ );
        }
        case 2:
        {    
            GameTextForPlayer( playerid, "~g~TEAM CJ", 300, 3 );
            SetPlayerTeam( playerid, TEAM_CJ );
        }    
    }        
    return 1;
}
Reply
#5

pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    switch ( classid ) {
        case 0:
        {
            GameTextForPlayer( playerid, "~r~TEAM Ballas", 300, 3 );
            SetPlayerTeam( playerid, TEAM_BALLAS );
        }
        case 1:
        {
            GameTextForPlayer( playerid, "~g~TEAM CJ", 300, 3 );
            SetPlayerTeam( playerid, TEAM_CJ );
        }
        case 2:
        {
            GameTextForPlayer( playerid, "~g~TEAM CJ", 300, 3 );
            SetPlayerTeam( playerid, TEAM_CJ );
        }
    }
    return 1;
}
Edit: People above were faster
Reply
#6

Really Thank you Guys - I Added for both of you Reputation [Too Bad my Reputation Points Don't Count Yet]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)