Help with taking strval(inputtext)
#1

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.
Reply
#2

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);
Reply
#3

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
Reply
#4

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

Read the last example.
Reply
#6

haha didnt read the error right =P sorted haha
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)