[HELP] lvl code
#1

Hello I was made credit system for level each player level I mean 10 15 is bring new credit money

and know I want to make a code if player has lvl 45 and all to 70 for example he get dialog

if(code here for lvl - so I need here something like 45>70 if you know what I mean?
{
dialog
}
Reply
#2

pawn Код:
if((Level[playerid] >= 0) && (Level[playerid] < 10)) {
    //stuff from 0 to 9
}
else if((Level[playerid] >= 10) && (Level[playerid] < 45)) {
   //stuff from 10 to 44
}
else if((Level[playerid] >= 45) && (Level[playerid] < 70)) {
  //stuff from 45 to 69
}
else if(Level[playerid] > 69) {
   // from 70 and higher
}
Or you could so a switch:

pawn Код:
switch(Level[playerid])
{
    case 0 .. 9:  { Dialog }
    case 10 .. 44: { Dialog }
    case 45 .. 70: { Dialog }
}
Reply
#3

I always find it easier to do something like:
pawn Код:
if(minimum <= variable <= maximum)
Example (Using the above poster's variables):
pawn Код:
if(0 <= Level[playerid] <= 9)
{
    //stuff from 0 to 9
}
else if(10 <= Level[playerid] <= 44)
{
   //stuff from 10 to 44
}
else if(45 <= Level[playerid] <= 69)
{
  //stuff from 45 to 69
}
else if(Level[playerid] >= 70)
{
   // from 70 and higher
}
Reply
#4

else if(PlayerInfo[playerid][Level] == 45 <= PlayerInfo[playerid][Level] == <= 69)
{
//stuff from 45 to 69
}

can it go something like this above the text? Thanks
Reply
#5

Why would you do that? That would just give you errors...
pawn Код:
if(45 <= PlayerInfo[playerid][Level] <= 69)
will be accepted for levels from 45 to 69.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)