Problem
#1

Hello,i've this small speedcap:

pawn Код:
public WantedLvlSpeed()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerSpeed(i, true) > 140.0 && TEAM_CIV)
        {
             new str[150];
             new plwl = GetPlayerWantedLevel(i);
             plwl = GetPlayerWantedLevel(i);
             SetPlayerWantedLevel(i,plwl +1);
             format(str,150,"- CRIME - Speed Limit Passed! (140 km/h) - You're going at %d km/h - Wanted Level: %d",GetPlayerSpeed(i,true),plwl);
             SendClientMessage(i,red,str);
             return 1;
        }
    }
    return 1;
}


But i've a problem,the speedcap works but with a little thing i need to fix. If a cop pass the 140km/h limit,he will get a wanted star.How to avoid that?

I want ONLY TEAM_CIV get's wanted stars and not TEAM_COP

Thanks.
Reply
#2

Try not to set a single time, remove the definition, thus :

pawn Код:
public WantedLvlSpeed()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerSpeed(i, true) > 140.0)
        {
             new str[150];
             new plwl = GetPlayerWantedLevel(i);
             plwl = GetPlayerWantedLevel(i);
             SetPlayerWantedLevel(i,plwl +1);
             format(str,150,"- CRIME - Speed Limit Passed! (140 km/h) - You're going at %d km/h - Wanted Level: %d",GetPlayerSpeed(i,true),plwl);
             SendClientMessage(i,red,str);
             return 1;
        }
    }
    return 1;
}
Reply
#3

Change
Код:
if(GetPlayerSpeed(i, true) > 140.0 && TEAM_CIV)
to
Код:
if(GetPlayerSpeed(i, true) > 140.0 && FactionVariable[ playerid ] == TEAM_CIV)
Change FactionVariable to the variable where you store player's faction.
Reply
#4

atm the TEAM_CIV is not included in any check. whats your playerid team enum? anyways, ima try:
pawn Код:
public WantedLvlSpeed()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerSpeed(i, true) > 140.0 && pInfo[playerid][pTeam]==TEAM_CIV)
        {
            new str[150];
            new plwl = GetPlayerWantedLevel(i);
            plwl = GetPlayerWantedLevel(i);
            SetPlayerWantedLevel(i,plwl +1);
            format(str,150,"- CRIME - Speed Limit Passed! (140 km/h) - You're going at %d km/h - Wanted Level: %d",GetPlayerSpeed(i,true),plwl);
            SendClientMessage(i,red,str);
            return 1;
        }
    }
    return 1;
}
edit: lol 3 answers @ same time
Reply
#5

Assuming you are using the SA-MP Team system.

pawn Код:
public WantedLvlSpeed()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerSpeed(i, true) > 140.0 && gTeam[i] == TEAM_CIV)
        {
             new str[150];
             new plwl = GetPlayerWantedLevel(i);
             plwl = GetPlayerWantedLevel(i);
             SetPlayerWantedLevel(i,plwl +1);
             format(str,150,"- CRIME - Speed Limit Passed! (140 km/h) - You're going at %d km/h - Wanted Level: %d",GetPlayerSpeed(i,true),plwl);
             SendClientMessage(i,red,str);
             return 1;
        }
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by .FuneraL.
Посмотреть сообщение
Try not to set a single time, remove the definition, thus :

pawn Код:
public WantedLvlSpeed()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerSpeed(i, true) > 140.0)
        {
             new str[150];
             new plwl = GetPlayerWantedLevel(i);
             plwl = GetPlayerWantedLevel(i);
             SetPlayerWantedLevel(i,plwl +1);
             format(str,150,"- CRIME - Speed Limit Passed! (140 km/h) - You're going at %d km/h - Wanted Level: %d",GetPlayerSpeed(i,true),plwl);
             SendClientMessage(i,red,str);
             return 1;
        }
    }
    return 1;
}
Nothing.

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Change
Код:
if(GetPlayerSpeed(i, true) > 140.0 && TEAM_CIV)
to
Код:
if(GetPlayerSpeed(i, true) > 140.0 && FactionVariable[ playerid ] == TEAM_CIV)
Change FactionVariable to the variable where you store player's faction.
FactionVariable?I use gTeam.

EDIT: T0pAz thanks,i'll try.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)