SA-MP Forums Archive
WantedLevel issue. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: WantedLevel issue. (/showthread.php?tid=473891)



WantedLevel issue. - LeeXian99 - 05.11.2013

Emm, hey, I just had a problem with this. When I've wanted level 0, it doesn't allow me to join cops/fbi/army class, how to fix this?

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(gTeam[playerid] == POLICE || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1)
    {
        SendClientMessage(playerid, -1, "You must have no wanted level to join this class!");
        return 0;
    }
    if(gTeam[playerid] == FBI || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1 && GetPlayerScore(playerid) < 500)
    {
        SendClientMessage(playerid, -1, "You need at least 500 score or must have no wanted level to join this class!");
        return 0;
    }
    if(gTeam[playerid] == ARMY || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1 && GetPlayerScore(playerid) < 1000)
    {
        SendClientMessage(playerid, -1, "You need at least 1000 score or must have no wanted level to join this class!");
        return 0;
    }
    return 1;
}
Please help in advance, it has annoyed me for some days.


Re: WantedLevel issue. - ikbenremco - 05.11.2013

Change this :

PHP код:
    if(gTeam[playerid] == POLICE || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1)
    {
        
SendClientMessage(playerid, -1"You must have no wanted level to join this class!");
        return 
0;
    } 
to:

Код HTML:
    if(gTeam[playerid] == POLICE || UserInfo[playerid][uWanted] != 0)
    {
        SendClientMessage(playerid, -1, "You must have no wanted level to join this class!");
        return 0;
    }
It's now when it isn't 0 it will send the message.

No need for get wanted level since it is an integer.


Re: WantedLevel issue. - LeeXian99 - 05.11.2013

It doesn't fix my problem. It still show me the message...


Re: WantedLevel issue. - Zex Tan - 05.11.2013

Change the
pawn Код:
if
To
pawn Код:
else if
After the gTeam == POLICE.


Re: WantedLevel issue. - JeaSon - 05.11.2013

he mean like this

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(gTeam[playerid] == POLICE || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1)
    {
        SendClientMessage(playerid, -1, "You must have no wanted level to join this class!");
        return 0;
    }
   else if(gTeam[playerid] == FBI || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1 && GetPlayerScore(playerid) < 500)
    {
        SendClientMessage(playerid, -1, "You need at least 500 score or must have no wanted level to join this class!");
        return 0;
    }
    else if(gTeam[playerid] == ARMY || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1 && GetPlayerScore(playerid) < 1000)
    {
        SendClientMessage(playerid, -1, "You need at least 1000 score or must have no wanted level to join this class!");
        return 0;
    }
    return 1;
}



Re: WantedLevel issue. - SAMProductions - 05.11.2013

Quote:
Originally Posted by Zex Tan
Посмотреть сообщение
Change the
pawn Код:
if
To
pawn Код:
else if
After the gTeam == POLICE.
Yes, Zex Tan was right;

it must have "else if" when there is "if" already

Here,
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(gTeam[playerid] == POLICE || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1)
    {
        SendClientMessage(playerid, -1, "You must have no wanted level to join this class!");
        return 0;
    }
    else if(gTeam[playerid] == FBI || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1 && GetPlayerScore(playerid) < 500)
    {
        SendClientMessage(playerid, -1, "You need at least 500 score or must have no wanted level to join this class!");
        return 0;
    }
    else if(gTeam[playerid] == ARMY || GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1 && GetPlayerScore(playerid) < 1000)
    {
        SendClientMessage(playerid, -1, "You need at least 1000 score or must have no wanted level to join this class!");
        return 0;
    }
    return 1;
}



Re: WantedLevel issue. - LeeXian99 - 05.11.2013

Nah, it still sends me a message when I've no wanted level if I wanted to choose these classes.

"This forum requires that you wait 240 seconds between posts. Please try again in 69 seconds." - FFS.


Re: WantedLevel issue. - Jstylezzz - 05.11.2013

Change '||' to '&&'. The way you did it, it will send the message whenever you are in the police team, with the '&&' it will just send the message if you are in the police team and have a wanted level aswell.
pawn Код:
if(gTeam[playerid] == POLICE && GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1)



Re: WantedLevel issue. - Zex Tan - 05.11.2013

Is gTeam a class? If so, put it in OnPlayerRequestClass.

On the other hand, I think its GetPlayerWantedLevel, change it to (playerid)

EDIT:Nvmind.


Re: WantedLevel issue. - JeaSon - 05.11.2013

yeh both are correct but we just didnt put " ||" to "&&"
Quote:

if(gTeam[playerid] == POLICE && GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1)

well

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(gTeam[playerid] == POLICE && GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1)
    {
        SendClientMessage(playerid, -1, "You must have no wanted level to join this class!");
        return 0;
    }
    else if(gTeam[playerid] == FBI && GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1 && GetPlayerScore(playerid) < 500)
    {
        SendClientMessage(playerid, -1, "You need at least 500 score or must have no wanted level to join this class!");
        return 0;
    }
    else if(gTeam[playerid] == ARMY && GetPlayerWantedLevel(UserInfo[playerid][uWanted]) >= 1 && GetPlayerScore(playerid) < 1000)
    {
        SendClientMessage(playerid, -1, "You need at least 1000 score or must have no wanted level to join this class!");
        return 0;
    }
    return 1;
}