SetPVarInt
#1

Hello!
How can I set the maximum value of a PVar?
I have SetPVarInt(playerid,"Wanted",wantedlevel)
I made a wanted level system,but it goes to 40+...infinite)
How can I set the maximum wanted level as 10?
Reply
#2

Код:
#define MAX_WANTED_LEVEL 10
then you just throw in IF and thats all
Reply
#3

Example:
pawn Код:
#define MAX_WANTED_LEVEL 10
//At the top near your includes, before any public functions.

//Your code here
if(wantedlevel > MAX_WANTED_LEVEL)
{
    wantedlevel = MAX_WANTED_LEVEL;
}
SetPVarInt(playerid,"Wanted",wantedlevel);
//Code continues...
Reply
#4

pawn Код:
native clamp(value, min=cellmin, max=cellmax);
pawn Код:
SetPVarInt(playerid, "Wanted", clamp(wantedlevel, 0, 10));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)