How to assign a 'nick' to a class?
#1

Hi there,

I would like to assign few player nicks to a certain class. I'm annoyed seeing people on my RPG taking characters from e.g Police when they don't have that job. All I would want is a code to assign all players for Civil Class, and a selection of players to certain classes after their nicks. Is it possible? Here I will give you my classes code, if needed

Код:
#define TEAM_TAXI 0
#define TEAM_POLICE 1
#define TEAM_MEDYK 2
#define TEAM_POMOC 3
#define TEAM_PILOT 4
#define TEAM_BUS 5
//#define TEAM_CELNIK 6
//#define TEAM_OCHRONA 7
#define TEAM_WOJAK 6
#define TEAM_PIZZABOY 7
#define TEAM_STRAZ 8
#define TEAM_BUDOWA 9
Код:
public OnPlayerRequestClass(playerid, classid) //Ten Public To Wybierałka Skina
{
SetPlayerPos(playerid,1973.6486,1176.7975,63.7670);
SetPlayerFacingAngle(playerid, 90.0);
SetPlayerCameraPos(playerid,1971.8549,1176.9382,63.7670);
SetPlayerCameraLookAt(playerid,1971.8549,1176.9382,63.7670);

SetPlayerClass(playerid, classid);
gPlayerClass[playerid] = classid;

 if(classid == 0 || classid == 2 || classid == 3 || classid == 4|| classid == 5|| classid == 6 || classid == 7|| classid == 8|| classid == 9|| classid == 10
 || classid == 11|| classid == 12|| classid == 13|| classid == 14|| classid == 15|| classid == 16|| classid == 17|| classid == 18|| classid == 19 || classid == 20
 || classid == 22|| classid == 23|| classid == 24|| classid == 25|| classid == 26|| classid == 27|| classid == 28|| classid == 29|| classid == 30
 || classid == 31|| classid == 32|| classid == 33|| classid == 34|| classid == 35|| classid == 36|| classid == 37|| classid == 38|| classid == 39|| classid == 40
 || classid == 41|| classid == 42|| classid == 43|| classid == 44|| classid == 45 || classid == 46){
GameTextForPlayer(playerid, "~b~cywil", 2000, 3);}

else if(classid == 47 || classid == 48){
gTeam[playerid] = TEAM_TAXI;
GameTextForPlayer(playerid, "~g~Taxi", 2000, 3);}

else if(classid == 49 || classid == 50){
gTeam[playerid] = TEAM_POMOC;
GameTextForPlayer(playerid, "~w~Mechanik / Mechanic", 2000, 3);}

else if(classid == 51){
gTeam[playerid] = TEAM_MEDYK;
GameTextForPlayer(playerid, "~w~Medyk / Medic", 2000, 3);}

else if(classid == 52 || classid == 53){
gTeam[playerid] = TEAM_PILOT;
GameTextForPlayer(playerid, "~w~Pilot", 2000, 3);}

else if(classid == 54 || classid == 55){
gTeam[playerid] = TEAM_PIZZABOY;
GameTextForPlayer(playerid, "~w~pizzaboy", 2000, 3);}

else if(classid == 56|| classid == 57){
gTeam[playerid] = TEAM_WOJAK;
GameTextForPlayer(playerid, "~w~Wojsko / Army", 2000, 3);}

else if(classid == 58){
gTeam[playerid] = TEAM_BUS;
GameTextForPlayer(playerid, "~w~Bus", 2000, 3);}

else if(classid == 59 || classid == 60 || classid == 61){
gTeam[playerid] = TEAM_POLICE;
GameTextForPlayer(playerid, "~w~Policja / Police", 2000, 3);}

else if(classid == 62 || classid == 63){
gTeam[playerid] = TEAM_STRAZ;
GameTextForPlayer(playerid, "~w~Strazak / Fireman", 2000, 3);}

else if(classid == 64 || classid == 65){
gTeam[playerid] = TEAM_BUDOWA;
GameTextForPlayer(playerid, "~w~Budowlaniec / Builder", 2000, 3);}
	return 1;

}
SetPlayerClass(playerid, classid) {

	if(classid == 0) {


	} else if(classid == 1) {

	gTeam[playerid] = TEAM_TAXI;

	} else if(classid == 2) {

	gTeam[playerid] = TEAM_POMOC;

	} else if(classid == 3) {

	gTeam[playerid] = TEAM_MEDYK;

	} else if(classid == 4) {

	gTeam[playerid] = TEAM_PILOT;
	
	} else if(classid == 5) {

	gTeam[playerid] = TEAM_PIZZABOY;
	
	} else if(classid == 6) {
	
	gTeam[playerid] = TEAM_WOJAK;
	
	} else if(classid == 7) {

	gTeam[playerid] = TEAM_BUS;
	
	} else if(classid == 5) {

	gTeam[playerid] = TEAM_POLICE;
	
	} else if(classid == 5) {
	
	gTeam[playerid] = TEAM_STRAZ;
	
	} else if(classid == 5) {

	gTeam[playerid] = TEAM_BUDOWA;
	}


}
Thank You and Regards
Puzi
Reply
#2

You can use GetPlayerSkin, but why this?:

pawn Код:
if(classid == 0 || classid == 2 || classid == 3 || classid == 4|| classid == 5|| classid == 6 || classid == 7|| classid == 8|| classid == 9|| classid == 10
 || classid == 11|| classid == 12|| classid == 13|| classid == 14|| classid == 15|| classid == 16|| classid == 17|| classid == 18|| classid == 19 || classid == 20
 || classid == 22|| classid == 23|| classid == 24|| classid == 25|| classid == 26|| classid == 27|| classid == 28|| classid == 29|| classid == 30
 || classid == 31|| classid == 32|| classid == 33|| classid == 34|| classid == 35|| classid == 36|| classid == 37|| classid == 38|| classid == 39|| classid == 40
 || classid == 41|| classid == 42|| classid == 43|| classid == 44|| classid == 45 || classid == 46){
You can just use:

pawn Код:
if(classid >= 0 && classid <= 46)
Reply
#3

Oh ty. Well, how do I assign a player to this?

Код:
else if(classid == 51){
gTeam[playerid] = TEAM_MEDYK;
GameTextForPlayer(playerid, "~w~Medyk / Medic", 2000, 3);}
The nick is [TDM]Sandi126...
Reply
#4

Sorry for DB, but please I need help. It annoys me, and I can't get it working with GetPlayerSkin. I guess im doing it wrong.
Reply
#5

I'm guessing your players have accounts and must login, so, modify player accounts to add a new variable: pMedic.

Make an admin command to make this variable pMedic = 1 for a player you choose.

Then under the callback OnPlayerRequestSpawn:

if(classid == MEDICSKINID)
{
if(PlayerInfo[playerid][pMedic] != 1)
{
SendClientMessage(playerid,COLOR_RED,"You must be made medic by an admin to choose medic skin!");
return 0;
}
}
Reply
#6

Reply


Forum Jump:


Users browsing this thread: