SA-MP Forums Archive
Help with taking strval(inputtext) - 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: Help with taking strval(inputtext) (/showthread.php?tid=271770)



Help with taking strval(inputtext) - slymatt - 25.07.2011

I want my inputtext to be taken away from another variable i tried doing it but it doest work this is what i tried:
Code:
GivePlayerMoney(playerid, -strval(inputtext));
That doesnt work but is there any way of doing it?

thanks for the help very appreciated.


Re: Help with taking strval(inputtext) - Miguel - 25.07.2011

Any number multiplied by "-1" will change its sign:
pawn Code:
new value = strval(inputtext);
if(value > 0) GivePlayerMoney(playerid, value * (-1));
else
{
    // The value was negative or just zero.
}
Or:
pawn Code:
new value = strval(inputtext);
if(value <= 0) value *= -1;
GivePlayerMoney(playerid, value);



Re: Help with taking strval(inputtext) - slymatt - 25.07.2011

ive got this
Code:
GivePlayerMoney(playerid, strval(inputtext)*-1);
I get these errors now
Code:
C:\Users\mattt\Desktop\ARRP\gamemodes\arrp.pwn(1757) : warning 215: expression has no effect
C:\Users\mattt\Desktop\ARRP\gamemodes\arrp.pwn(1757) : error 001: expected token: ";", but found "-identifier-"
Please help haha


Re: Help with taking strval(inputtext) - iPLEOMAX - 25.07.2011

I doubt you have error on that line, Show us line '1757' and it's related. Maybe you forgot a '=' sign.


Re: Help with taking strval(inputtext) - Miguel - 25.07.2011

Read the last example.


Re: Help with taking strval(inputtext) - slymatt - 25.07.2011

haha didnt read the error right =P sorted haha