06.02.2012, 12:37
I made a command and I used if/else statements but I changed my mind and I wanted to convert it to cases.
So I switch the money but while I was compiling I noticed that the compiler stopped response.
Did I do anything wrong.
So I switch the money but while I was compiling I noticed that the compiler stopped response.
Did I do anything wrong.
pawn Код:
// If/Else Statements:
if( money == 200000 )
{
// Code
}
else if( money > 200000 && money < 400000 )
{
// Code
}
// More with if statements..
// The last statement
else
{
// Code
}
// ==========
// After converting..
// Cases:
switch( money )
{
case 200000: SetPlayerWantedLevel( id, 1 );
case 200001 .. 399999: SetPlayerWantedLevel( id, 2 );
case 400001 .. 799999: SetPlayerWantedLevel( id, 3 );
case 800001 .. 1599999: SetPlayerWantedLevel( id, 4 );
case 1600001 .. 3199999: SetPlayerWantedLevel( id, 5 );
default: SetPlayerWantedLevel( id, 6 );
}