How to print out specific word if value is something ?(basically solved)
#1

Lets say my calculations give me number 30 or over. How to make that pawno will print out "Good" .
Reply
#2

pawn Code:
if(value >= 30) return print("Good"); // greater or equal
or

pawn Code:
if(value > 29) return print("Good"); // more than 29 is 30 or more
Reply
#3

Code:
if(INTEGERNAME=30) {
printf("The integer is over 30 and so this is shown.");
printf("The integer is %s", INTEGERNAME);
}
Reply
#4

Quote:
Originally Posted by jameskmonger
Code:
if(INTEGERNAME=30) {
printf("The integer is over 30 and so this is shown.");
printf("The integer is %s", INTEGERNAME);
}
This is wrong:
"=" should be "==" and it will only print if the integer == 30. If it's more it won't do anything.
Reply
#5

It seems to be problem in my calculation instead... now it gives me error 022: must be lvalue (non-constant)

Code:
value = floatround(vHealth / 10);
vHealth is:
Code:
GetVehicleHealth(vehicleid, vHealth);
Reply
#6

Why don't you use floatdiv?

pawn Code:
value = floatdiv(vHealth, 10);
Reply
#7

Quote:
Originally Posted by wiilweer
Code:
value = floatround(vHealth / 10);
This syntax.
Code:
floatround(value, method);
https://sampwiki.blast.hk/wiki/Scripting...Old#floatround
https://sampwiki.blast.hk/wiki/Floatround
Reply
#8

Basically they are same. Still getting same error.
Reply
#9

I got the value thingy, problem is in another place. Making new topic couse this is getting too much Off the headline.
Reply
#10

Quote:
Originally Posted by SAWC™
Quote:
Originally Posted by jameskmonger
Code:
if(INTEGERNAME=30) {
printf("The integer is over 30 and so this is shown.");
printf("The integer is %s", INTEGERNAME);
}
This is wrong:
"=" should be "==" and it will only print if the integer == 30. If it's more it won't do anything.
Sorry, I'm used to java.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)