Input Dialog
#1

Hi everyone,
I'm having a problem with a dialog i am creating to sell wood which has been cut from trees.
This line:

PHP код:
if(inputtext[0] == '10'
Gives me the following error(s):
PHP код:
D:\SAMPSERVER\Los Angeles Roleplay\gamemodes\New.pwn(13674) : error 027invalid character constant
D
:\SAMPSERVER\Los Angeles Roleplay\gamemodes\New.pwn(13674) : error 027invalid character constant 
What could i do to fix this?
Reply
#2

Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Hi everyone,
I'm having a problem with a dialog i am creating to sell wood which has been cut from trees.
This line:

PHP код:
if(inputtext[0] == '10'
Gives me the following error(s):
PHP код:
D:\SAMPSERVER\Los Angeles Roleplay\gamemodes\New.pwn(13674) : error 027invalid character constant
D
:\SAMPSERVER\Los Angeles Roleplay\gamemodes\New.pwn(13674) : error 027invalid character constant 
What could i do to fix this?
'10' has actually two characters '1' and '0'
you are able to store only 1 character at each slot, so you may instead use

PHP код:
if(inputtext[0] == '1' && inputtext[1] == '0'
Reply
#3

It works very well but i do have a problem.
When i type 10, the script executes 1 and 10. will tell you the following:
You have sold 1 pile of logs to Darryl(NPC) for 200$
You have sold 10 pile of logs to Darryl(NPC) for 2000$

Code:
PHP код:
                    if(inputtext[0] == '1')
                    {
                         
// do something
                    
}
                    if(
inputtext[0] == '1' && inputtext[1] == '0')
                    {
                         
// do something
                    

I did try the following, but this does only execute if(inputtext[0] == '1') no matter which input you use.

PHP код:
                    if(inputtext[0] == '1')
                    {
                         
// do something
                    
}
                    else if(
inputtext[0] == '1' && inputtext[1] == '0')
                    {
                         
// do something
                    

What am i doing wrong?
Reply
#4

PHP код:
                    if(inputtext[0] == '1' && inputtext[1] == '0')
                    {
                         
// do something
                    
}
                    else if(
inputtext[0] == '1')
                    {
                         
// do something
                    

Reply
#5

I actually need to add 40 of em, because there are 40 player slots...
Isn't there a method which is more easy and better?
Reply
#6

PHP код:
if(strval(inputtext) > && strval(inputtext) < 41)
{
    new 
string[128];
    
format(string,sizeof(string),"You sold %d ...",strval(inputtext));
    
SendClientMessage (playerid,-1,string);

Dont know your code



//Handy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)