Lower Wanted Level - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Lower Wanted Level (
/showthread.php?tid=90782)
Lower Wanted Level -
Kodman262 - 10.08.2009
ello, im trying to make a lower wanted level timer. I have this, but it gives me theses errors and i dont know what is wrong. If you could help me i would really appreciate it. Thanks
Code :
Код:
public Lwanted()
{
if(GetPlayerWantedLevel(playerid) > 1 && GetPlayerWantedLevel(playerid) < 6) // <---- line 448
{
SetPlayerWantedLevel(playerid, - 1); // <---- line 450
}
}
Errors :
Код:
C:\***\gm.pwn(448) : error 017: undefined symbol "playerid"
C:\***\gm.pwn(450) : error 017: undefined symbol "playerid"
Re: Lower Wanted Level -
RSX - 10.08.2009
Here's the problem, you have to put things you use for function (this time "playerid") in 2 places
1.
Код:
forward Lwanted(playerid);
2.
Код:
public Lwanted(playerid)
That's all, ou, and your function looks wrong to me...
I guess it should be:
Код:
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel-1);
PS:If you want to wanted level disapear "nowhere" then save it in variable!
Re: Lower Wanted Level -
Kodman262 - 10.08.2009
Thank you so, much. Now that you said that i slaped my self on the head. I totaly should have caught that!

But again thanks.
Re: Lower Wanted Level -
Dark_Kostas - 10.08.2009
Quote:
Originally Posted by Kodman262
Thank you so, much. Now that you said that i slaped my self on the head. I totaly should have caught that!  But again thanks.
|
Also could you show us your SetTimer? Because im 99% sure it will not work.
Re: Lower Wanted Level -
WrathOfGenesis - 10.08.2009
pawn Код:
public LWantedLevel ( )
{
for ( new playerid = 0; playerid < MAX_PLAYERS; playerid ++ )
{
if ( IsPlayerConnected ( playerid ) )
{
if ( GetPlayerWantedLevel ( playerid ) > 1 && GetPlayerWantedLevel ( playerid ) < 6 )
{
SetPlayerWantedLevel ( playerid , GetPlayerWantedLevel ( playerid ) - 1 );
}
}
}
}
If you put this as your timer and it will work for all people with wanted levels. Saves making 200 timers if you have 200 players.
Re: Lower Wanted Level -
Kodman262 - 10.08.2009
Thank you, i was just about to post something because my level went up instead of down. xD Thanks gents
Re: Lower Wanted Level -
RSX - 10.08.2009
Quote:
Originally Posted by WrathOfGenesis
pawn Код:
public LWantedLevel ( ) { for ( new playerid = 0; playerid < MAX_PLAYERS; playerid ++ ) { if ( IsPlayerConnected ( playerid ) ) { if ( GetPlayerWantedLevel ( playerid ) > 1 && GetPlayerWantedLevel ( playerid ) < 6 ) { SetPlayerWantedLevel ( playerid , GetPlayerWantedLevel ( playerid ) - 1 ); } } } }
If you put this as your timer and it will work for all people with wanted levels. Saves making 200 timers if you have 200 players.
|
I would make like this:
pawn Код:
public LWantedLevel ()
{
for (new playerid = 0; playerid<MAX_PLAYERS; playerid++)
{
if (IsPlayerConnected(playerid))
{
if (GetPlayerWantedLevel(playerid)=>1 && GetPlayerWantedLevel(playerid)=<6)
{
SetPlayerWantedLevel (playerid,GetPlayerWantedLevel(playerid)-1);
}
}
}
}
or it would ignore players with 1 and 6 wanted lvl :P
Re: Lower Wanted Level -
WrathOfGenesis - 10.08.2009
Its exactly the same. I just have strange indentation and spacing habbits lol.
Re: Lower Wanted Level -
RSX - 10.08.2009
Код:
if ( GetPlayerWantedLevel ( playerid ) > 1 && GetPlayerWantedLevel ( playerid ) < 6 )
Isn't the same as
Код:
if (GetPlayerWantedLevel(playerid)=>1 && GetPlayerWantedLevel(playerid)=<6)
(I didn't noticed this at start too

)
Re: Lower Wanted Level -
Kodman262 - 10.08.2009
Ok this is kinda going off topic of the topic, but everytime i get in a car it gives me wanted stares. here is my code.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
poCar = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(poCar == poCar && gTeam[playerid] != TEAM_COP)
{
SetPlayerWantedLevel(playerid, 5);
CheckWantedLevel(playerid);
}
}
return 1;
}
pawn Код:
poCar = AddStaticVehicle(596,1536.1658,-1678.9585,13.2145,359.6118,13,13); // this one cop
Again thanks.