public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, -1566.880859, -2729.819824, 48.743457); SetPlayerFacingAngle(playerid, 56.649963); SetPlayerCameraLookAt(playerid, -1566.880859, -2729.819824, 48.743457); SetPlayerCameraPos(playerid, -1566.880859 + (10 * floatsin(-56.649963, degrees)), -2729.819824 + (10 * floatcos(-56.649963, degrees)), 48.743457); switch(classid) // Switching between the classids { case 0..2: { SetPlayerTeam(playerid, Trucker); // Setting players team GameTextForPlayer(playerid, "~w~Trucker", 1000, 3); // Screen msg for player to show what team } case 3..4: { SetPlayerTeam(playerid, BusDriver); // Same as above GameTextForPlayer(playerid, "~y~Bus Driver", 1000, 3); // Same as above } case 5..7: { SetPlayerTeam(playerid, Police); // Same as above GameTextForPlayer(playerid, "~b~Police", 1000, 3); // Same as above } } return 1; }
//cant use this class if player score is not less than 100.
if(GetPlayerScore(playerid) < 100) return SendClientMessage(playerid, -1,"Your Error Message here");
public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, -1566.880859, -2729.819824, 48.743457); SetPlayerFacingAngle(playerid, 56.649963); SetPlayerCameraLookAt(playerid, -1566.880859, -2729.819824, 48.743457); SetPlayerCameraPos(playerid, -1566.880859 + (10 * floatsin(-56.649963, degrees)), -2729.819824 + (10 * floatcos(-56.649963, degrees)), 48.743457); switch(classid) // Switching between the classids { case 0..2: { SetPlayerTeam(playerid, Trucker); // Setting players team GameTextForPlayer(playerid, "~w~Trucker", 1000, 3); // Screen msg for player to show what team } case 3..4: { if(GetPlayerScore(playerid) < 25) return SendClientMessage(playerid, COLOR_RED,"You Need 25 Scores to be Bus Driver."); SetPlayerTeam(playerid, BusDriver); // Same as above GameTextForPlayer(playerid, "~y~Bus Driver", 1000, 3); // Same as above } case 5..7: { if(GetPlayerScore(playerid) < 25) return SendClientMessage(playerid, COLOR_RED,"You Need 100 Scores to be Police Officer."); SetPlayerTeam(playerid, Police); // Same as above GameTextForPlayer(playerid, "~b~Police", 1000, 3); // Same as above } } return 1; }
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, -1566.880859, -2729.819824, 48.743457);
SetPlayerFacingAngle(playerid, 56.649963);
SetPlayerCameraLookAt(playerid, -1566.880859, -2729.819824, 48.743457);
SetPlayerCameraPos(playerid, -1566.880859 + (10 * floatsin(-56.649963, degrees)), -2729.819824 + (10 * floatcos(-56.649963, degrees)), 48.743457);
switch(classid) // Switching between the classids
{
case 0..2:
{
if (GetPlayerScore(playerid) >= 100)
{
SetPlayerTeam(playerid, Trucker); // Setting players team
GameTextForPlayer(playerid, "~w~Trucker", 1000, 3); // Screen msg for player to show what team
}
else {
SendClientMessage(playerid,-1,"Error message");}
}
case 3..4:
{
if (GetPlayerScore(playerid) >= 200)
{
SetPlayerTeam(playerid, BusDriver); // Same as above
GameTextForPlayer(playerid, "~y~Bus Driver", 1000, 3); // Same as above
}
else {
SendClientMessage(playerid,-1,"Error message");}
}
case 5..7:
{
if (GetPlayerScore(playerid) >= 300)
{
SetPlayerTeam(playerid, Police); // Same as above
GameTextForPlayer(playerid, "~b~Police", 1000, 3); // Same as above
}
else {
SendClientMessage(playerid,-1,"Error message");}
}
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
new team = GetPlayerTeam(playerid);
if(team == BusDriver && GetPlayerScore(playerid) < 25) return SendClientMessage(playerid, COLOR_RED,"You Need 25 Scores to be Bus Driver.");
if(team == Police && GetPlayerScore(playerid) < 100) return SendClientMessage(playerid, COLOR_RED,"You Need 100 Scores to be Police Officer.");
return 1;
}
Try this..
pawn Код:
|
Silly me. that should be in OnPlayerRequestSpawn
do you have team variables for those 3 classes? |
public OnPlayerSpawn(playerid) { if(GetPlayerTeam(playerid) == Trucker) { SetPlayerColor(playerid, COLOR_WHITE); if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 50) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"* %s[%d] has Joined Trucker Class.",pName,playerid); SendClientMessageToAll(COLOR_ORANGE,string); SendClientMessage(playerid, COLOR_YELLOW,"Your Now Trucker, Use /work to start Work."); SendClientMessage(playerid, COLOR_YELLOW,"Use /cmds for more Help."); } if (GetPlayerScore(playerid) >= 51 && GetPlayerScore(playerid) <= 100000) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"* %s[%d] has Joined Trucker Class.",pName,playerid); SendClientMessageToAll(COLOR_ORANGE,string); } } else if(GetPlayerTeam(playerid) == BusDriver) { SetPlayerColor(playerid, COLOR_YELLOW); if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 50) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"* %s[%d] has Joined Bus Driver Class.",pName,playerid); SendClientMessageToAll(COLOR_ORANGE,string); SendClientMessage(playerid, COLOR_YELLOW,"Your Now Bus Driver, Use /work to start Work."); SendClientMessage(playerid, COLOR_YELLOW,"Use /cmds for more Help."); } if (GetPlayerScore(playerid) >= 51 && GetPlayerScore(playerid) <= 100000) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"* %s[%d] has Joined Bus Driver Class.",pName,playerid); SendClientMessageToAll(COLOR_ORANGE,string); } } else if(GetPlayerTeam(playerid) == Police) { SetPlayerColor(playerid, COLOR_BLUE); if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 50) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"* %s[%d] has Joined Police Class.",pName,playerid); SendClientMessageToAll(COLOR_ORANGE,string); SendClientMessage(playerid, COLOR_YELLOW,"Your Now Police Officer, Use /work to Know About your Work."); SendClientMessage(playerid, COLOR_YELLOW,"Use /cmds for more Help."); } if (GetPlayerScore(playerid) >= 51 && GetPlayerScore(playerid) <= 100000) { new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"* %s[%d] has Joined Police Class.",pName,playerid); SendClientMessageToAll(COLOR_ORANGE,string); } } return 1; }
Silly me. that should be in OnPlayerRequestSpawn
EDIT add this on your OnPlayerRequestSpawn callback pawn Код:
|
public OnPlayerRequestSpawn(playerid)
{
new team = GetPlayerTeam(playerid);
new Score = GetPlayerScore(playerid);
if(team == BusDriver && Score <= 25) return SendClientMessage(playerid, COLOR_RED,"You Need 25 Scores to be Bus Driver.");
if(team == Police && Score <= 100) return SendClientMessage(playerid, COLOR_RED,"You Need 100 Scores to be Police Officer.");
return 1;
}
I bet this one will work try this. this will work for sure.
pawn Код:
|