Question about strval -
horsemeat - 22.03.2013
This is a quick question
if you use
Код:
val = strval(inputtext)
but if you enter words what happens
does the value equal 0 or does it do something else
Re: Question about strval -
Rock - 22.03.2013
Do some tests and see what happens.
Re: Question about strval -
horsemeat - 22.03.2013
alright I will try that, That was quick 5 seconds
Re: Question about strval -
horsemeat - 22.03.2013
ok I created this command to test it it out but it would not compile the compiler keeps crashing
here is the command anything wrong with this
Код:
CMD:test(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new input[128];
new string[128];
new value;
new name[128];
if(sscanf(params,"s",input)
{
return "SYNTAX /test [input]");
}
GetPlayerName(playerid,name,sizeof(name));
val = strval(input);
format(string,128,"~TEST~[%s] has inputed %s and the value number is %i",inputtext,value);
SendClientMessageToAll(DARKBLUE,string);
}
else
{
SendClientMessage(playerid, RED, "ERROR");
}
return 1;
}
I know it is this command because I commented it out and it worked perfectly fine
Re: Question about strval -
mastermax7777 - 22.03.2013
return "SYNTAX /test [input]"); ->> lol wtf?
do if(sscanf(params,"s",input)) return SendClientMessage(playeid, -1, "SYNTAX /test [input]");
Re: Question about strval -
Tika Spic - 22.03.2013
why "inputtext" its just input in the scmta
Re: Question about strval -
horsemeat - 22.03.2013
[QUOTE=mastermax7777;2440754]return "SYNTAX /test [input]"); ->> lol wtf?
lol holey shit that is the stupidest mistake ever
well thanks
Re: Question about strval -
horsemeat - 22.03.2013
wow I made more mistake then I thought should have looked closer but I am a lttlel clucker
c]:{
Re: Question about strval -
Misiur - 22.03.2013
Oh, in case you are wondering strval trims strings so you don't have to worry about whitespaces before and after value (strval(" 1304 ") == 1304)
Re: Question about strval -
Basssiiie - 22.03.2013
You can't return strings directly like that. You also can't return both integers and strings in the same function. But I guess you already discovered that.
For your strval question: if I remember correctly, it will return 0 if there are no numbers in the string. But it will return 15 when your input is "tysd15asdfae".