Text and Skin show when we choose class
#1

i want that when we select spawn class so it must show a skin and text on it, in mine it doesnt show any and we just click >> or << and then we spawn.
plz help me in this
Reply
#2

Use AddPlayerClass and GameTextForPlayer.
Reply
#3

https://sampwiki.blast.hk/wiki/OnPlayerRequestClass
Reply
#4

Try this it may help you out:

PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

//]]========: TEAMS :=======[[//
#define TEAM_COP 0
#define TEAM_CIVI 5
#define TEAM_NONE 6

main()
{
    print(
"\n----------------------------------");
    print(
" Blank Gamemode by your name here");
    print(
"----------------------------------\n");
}

public 
OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("OnPlayerRequestClass");
    
AddPlayerClass2881958.37831343.157215.3746269.142500000); // Cop
    
AddPlayerClass3111958.37831343.157215.3746269.142500000); // Cop
    
AddPlayerClass3101958.37831343.157215.3746269.142500000); // Cop
    
AddPlayerClass1761958.37831343.157215.3746269.142500000); // Robber
    
AddPlayerClass1771958.37831343.157215.3746269.142500000); // Robber
    
AddPlayerClass2931958.37831343.157215.3746269.142500000); // Robber
    
return 1;
}

public 
OnGameModeExit()
{
    return 
1;
}

public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    switch ( 
classid // This is like a if/elseif statement.
    
{
        case 
0// If the classid is 0
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~B~Cops"3000);
            
SetPlayerTeamplayeridTEAM_COP ); // Sets the player's team to TEAM_BALLAS
        
}

        case 
1// If the classid is 1
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~B~Cops"3000);
            
SetPlayerTeamplayeridTEAM_COP ); // Sets the player's team to TEAM_CJ
        
}

        case 
2// If the classid is 1
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~B~Cops"3000);
            
SetPlayerTeamplayeridTEAM_COP ); // Sets the player's team to TEAM_CJ
        
}

        case 
3// If the classid is 2
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~W~Civilian"3000);
            
SetPlayerTeamplayeridTEAM_CIVI ); // Sets the player's team to TEAM_CJ
        
}

        case 
4// If the classid is 2
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~W~Civilian"3000);
            
SetPlayerTeamplayeridTEAM_CIVI ); // Sets the player's team to TEAM_CJ
        
}

        case 
5// If the classid is 2
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~W~Civilian"3000);
            
// 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_CIVI ); // Sets the player's team to TEAM_CJ
        
}
    }
    return 
1// This means the callback is executed succesfully AFAIK.

and if you didn't understood any step from mine,

Try reading and understand this tutorial:

Click Here
Reply
#5

Quote:
Originally Posted by Jerry12
Посмотреть сообщение
Try this it may help you out:

PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
//]]========: TEAMS :=======[[//
#define TEAM_COP 0
#define TEAM_CIVI 5
#define TEAM_NONE 6
main()
{
    print(
"\n----------------------------------");
    print(
" Blank Gamemode by your name here");
    print(
"----------------------------------\n");
}
public 
OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("OnPlayerRequestClass");
    
AddPlayerClass2881958.37831343.157215.3746269.142500000); // Cop
    
AddPlayerClass3111958.37831343.157215.3746269.142500000); // Cop
    
AddPlayerClass3101958.37831343.157215.3746269.142500000); // Cop
    
AddPlayerClass1761958.37831343.157215.3746269.142500000); // Robber
    
AddPlayerClass1771958.37831343.157215.3746269.142500000); // Robber
    
AddPlayerClass2931958.37831343.157215.3746269.142500000); // Robber
    
return 1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    switch ( 
classid // This is like a if/elseif statement.
    
{
        case 
0// If the classid is 0
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~B~Cops"3000);
            
SetPlayerTeamplayeridTEAM_COP ); // Sets the player's team to TEAM_BALLAS
        
}
        case 
1// If the classid is 1
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~B~Cops"3000);
            
SetPlayerTeamplayeridTEAM_COP ); // Sets the player's team to TEAM_CJ
        
}
        case 
2// If the classid is 1
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~B~Cops"3000);
            
SetPlayerTeamplayeridTEAM_COP ); // Sets the player's team to TEAM_CJ
        
}
        case 
3// If the classid is 2
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~W~Civilian"3000);
            
SetPlayerTeamplayeridTEAM_CIVI ); // Sets the player's team to TEAM_CJ
        
}
        case 
4// If the classid is 2
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~W~Civilian"3000);
            
SetPlayerTeamplayeridTEAM_CIVI ); // Sets the player's team to TEAM_CJ
        
}
        case 
5// If the classid is 2
        
// Then
            
GameTextForPlayerplayerid"~Y~Los Santos ~W~Civilian"3000);
            
// 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_CIVI ); // Sets the player's team to TEAM_CJ
        
}
    }
    return 
1// This means the callback is executed succesfully AFAIK.

and if you didn't understood any step from mine,

Try reading and understand this tutorial:

Click Here
not working
Reply
#6

Quote:
Originally Posted by StevenLV
Посмотреть сообщение
not working
It's a bad example. The function you need to look at is OnPlayerRequestClass.

People shouldn't be simply handing out code as it's terrible for you to learn as you won't learn as most times people simply copy/paste it in, and end up with it 'not working' and don't try fix, or learning to fix it.
Reply
#7

pplz, it isnt solved yet
Reply
#8

The solution is learning to do it... You use OnPlayerRequestClass to do what you want.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)