SA-MP Forums Archive
How to print out specific word if value is something ?(basically solved) - 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: How to print out specific word if value is something ?(basically solved) (/showthread.php?tid=116989)



How to print out specific word if value is something ?(basically solved) - wiilweer - 30.12.2009

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


Re: How to print out specific word if value is something ? - Miguel - 30.12.2009

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



Re: How to print out specific word if value is something ? - jameskmonger - 30.12.2009

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



Re: How to print out specific word if value is something ? - Miguel - 30.12.2009

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.


Re: How to print out specific word if value is something ? - wiilweer - 30.12.2009

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);



Re: How to print out specific word if value is something ?(problem in calculation) - Miguel - 30.12.2009

Why don't you use floatdiv?

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



Re: How to print out specific word if value is something ? - Adamus - 30.12.2009

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


Re: How to print out specific word if value is something ?(problem in calculation) - wiilweer - 30.12.2009

Basically they are same. Still getting same error.


Re: How to print out specific word if value is something ?(problem in calculation) - wiilweer - 30.12.2009

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


Re: How to print out specific word if value is something ? - jameskmonger - 31.12.2009

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.