strval inputtext
#1

PHP Code:
             if(response)
             {
                 new 
zin[222];
                if(
strval(inputtext) > 128) return SendClientMessage(playerid, -1"{f03333}Tekstas per ilgas!");
                if(
GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, -1"{f03333}Neturite pakankamai pinigų!");
                
format(zin,sizeof(zin),"{ff6699}[{ff99cc}SKELBIMAS ] %s{ff6699}{ff99cc}: %s",GET_NAME(playerid),strval(inputtext));
                
SendClientMessageToAll(0xffcc00FF,zin);
                
format(zin,sizeof(zin),"{ff6699} %s",strval(inputtext));
                   
SendClientMessageToAll(-1zin);
                
GivePlayerMoneyA(playerid,-500);
                   
SendClientMessage(playerid, -1"Sumokėjote 500$");
             } 
it doesn't show the text, what could be the problem
Reply
#2

Strval returns an integer, so you should change %s to %d
Reply
#3

Quote:
Originally Posted by Sasino97
View Post
Strval returns an integer, so you should change %s to %d
how should I make it return a string?
Reply
#4

Quote:
Originally Posted by Kevinas100
View Post
how should I make it return a string?
Just remove strval() around the "inputtext" that'll keep it as a string

Strval converts a string into a integer value.

Code:
format(zin,sizeof(zin),"{ff6699}[{ff99cc}SKELBIMAS ] %s{ff6699}{ff99cc}: %s" ,GET_NAME(playerid), inputtext); 
SendClientMessageToAll(0xffcc00FF,zin); 
format(zin,sizeof(zin),"{ff6699} %s", inputtext);
Also use "strlen" for the character count.

Code:
if(strlen(inputtext) > 128) return SendClientMessage(playerid, -1, "{f03333}Tekstas per ilgas!");
Reply
#5

Quote:
Originally Posted by Shaneisace
View Post
Just remove strval() around the "inputtext" that'll keep it as a string

Strval converts a string into a integer value.

Code:
format(zin,sizeof(zin),"{ff6699}[{ff99cc}SKELBIMAS ] %s{ff6699}{ff99cc}: %s" ,GET_NAME(playerid), inputtext); 
SendClientMessageToAll(0xffcc00FF,zin); 
format(zin,sizeof(zin),"{ff6699} %s", inputtext);
Also use "strlen" for the character count.

Code:
if(strlen(inputtext) > 128) return SendClientMessage(playerid, -1, "{f03333}Tekstas per ilgas!");
alright, thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)