Score Req. OnPlayerRequestClass.
#1

Hey All,

i have this script under OnPlayerRequestClass :-
Код:
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;
}
i want to add score limits to it.
Like 20 Scores to Be a Bus Driver and 100 To be a Police Officer.
If they do not have that much score, they should not be spawned and sent a Message :"You need ... to be ..."

Thanks.
Reply
#2

you will only need is GetPlayerScore(playerid) for that

just put this on every cases that you want to have score limit

pawn Код:
//cant use this class if player score is not less than 100.
if(GetPlayerScore(playerid) < 100) return SendClientMessage(playerid, -1,"Your Error Message here");
Reply
#3

Not worked.
When i select Police, it says message but im able to spawn.

Код:
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;
}
Reply
#4

Removed
Reply
#5

Try this..

pawn Код:
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;
}
Reply
#6

Silly me. that should be in OnPlayerRequestSpawn

EDIT

add this on your OnPlayerRequestSpawn callback

pawn Код:
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;
}
PS: sorry i did not that you are using SetPlayerTeam. so there you go
Reply
#7

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
Try this..

pawn Код:
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;
}
Same Problem!

Quote:
Originally Posted by pds2012
Посмотреть сообщение
Silly me. that should be in OnPlayerRequestSpawn

do you have team variables for those 3 classes?
yes, :-
Код:
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;
}
Reply
#8

Quote:
Originally Posted by pds2012
Посмотреть сообщение
Silly me. that should be in OnPlayerRequestSpawn

EDIT

add this on your OnPlayerRequestSpawn callback

pawn Код:
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;
}
PS: sorry i did not that you are using SetPlayerTeam. so there you go
Dude, it just give message but player get spawn.
Reply
#9

I bet this one will work try this. this will work for sure.

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;
}
Reply
#10

Quote:
Originally Posted by pds2012
Посмотреть сообщение
I bet this one will work try this. this will work for sure.

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;
}
Still same problem.
It spawns player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)