3D scoring help
#1

Well, i have no clue how to do this. I keep attempting to try to do this, but everytime messing up my script. So here is the problem.

pawn Код:
if(GetPlayerScore(playerid) < 250)
{
       SetPlayerWantedLevel(playerid, 1);
       new Float:X, Float:Y, Float:Z;
       GetPlayerPos(playerid, X, Y, Z);
       Newb[playerid] = Create3DTextLabel("Recruit",0x00FFFFFF,X, Y, Z+2.0,20.0,1);
                  Attach3DTextLabelToPlayer(Newb[playerid],playerid,0,0,1.2);
}
else if(GetPlayerScore(playerid) > 250);
{
                 //not done yet
}
I need help on that second part. Like I got the getplayerscore and if his score is less then 250 then he will have 3D text saying recruit.

But then I have problem. I want to make another rank. Where I get the players score and it is more than 250 but less than 350.

pawn Код:
else if (GetPlayerScore (playerid) > 250 & < 350 // I want it where they have to be more than 250 but less than 350.
{
          SetPlayerWantedLevel(playerid, 2);
}
Reply
#2

I believe it goes along something like this..
pawn Код:
new pscore;
    pscore = GetPlayerScore(playerid); // Get the players score into pscore
    if((pscore >= 250) && (pscore <= 350)) // If pscore is greater than or equal to 250, and less than or equal to 350
    {
        // Code
    }
Reply
#3

wow thanks alot man
Reply
#4

Quote:
Originally Posted by iFriSki
Посмотреть сообщение
I believe it goes along something like this..
pawn Код:
new pscore;
    pscore = GetPlayerScore(playerid); // Get the players score into pscore
    if((pscore >= 250) && (pscore <= 350)) // If pscore is greater than or equal to 250, and less than or equal to 350
    {
        // Code
    }
Note that there is no need in storing it in a variable while you can do

pawn Код:
if((GetPlayerScore(playerid) >= 250 && GetPlayerScore(playerid) <= 350))
    {
        // other code
    }
Reply
#5

Quote:
Originally Posted by playbox12
Посмотреть сообщение
Note that there is no need in storing it in a variable while you can do

pawn Код:
if((GetPlayerScore(playerid) >= 250 && GetPlayerScore(playerid) <= 350))
    {
        // other code
    }
Also no need for the extra parenthesis. ex:

pawn Код:
if(GetPlayerScore(playerid) >= 250 && GetPlayerScore(playerid) <= 350)

// Pawn also supports this shorthand
if(250 <= GetPlayerScore(playerid) <= 350)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)