Return ShowPlayerDialog Problem!
#1

Here my command: http://pastebin.com/4GvkPP2d

The problem ?

Console doesn't show any error or warning but when i execute "/chouse 10" or "/chouse 99999999" for example, the SHOWPLAYERDIALOG after that RETURN doens't work, and instead shows "Ok".

Help!

PS: Sorry for my english, i'm Italian.
Reply
#2

PHP код:
CMD:chouse(playeridparams[])
{
    new 
priceinteriorFloat:pXFloat:pYFloat:pZ;
    
GetPlayerPos(playeridpXpYpZ);
    if(
sscanf(params"i"price)) return SendClientMessage(playeridCOLOR_RED"Usage: /chouse <Prezzo>");
    if(
price 20 || price 99999) { SendClientMessage(playeridCOLOR_GREEN"Price Between 20 and 999999"); return 1; }
    
SendClientMessage(playeridCOLOR_GREEN"Ok");
    return 
1;

Reply
#3

Quote:
Originally Posted by IgorLuiz
Посмотреть сообщение
PHP код:
CMD:chouse(playeridparams[])
{
    new 
priceinteriorFloat:pXFloat:pYFloat:pZ;
    
GetPlayerPos(playeridpXpYpZ);
    if(
sscanf(params"i"price)) return SendClientMessage(playeridCOLOR_RED"Usage: /chouse <Prezzo>");
    if(
price 20 || price 99999) { SendClientMessage(playeridCOLOR_GREEN"Price Between 20 and 999999"); return 1; }
    
SendClientMessage(playeridCOLOR_GREEN"Ok");
    return 
1;

Work, but I don't undestand that "return 1;" after SendClientMessage(playerid, COLOR_GREEN, "Price Between 20 and 999999");
Reply
#4

Quote:
Originally Posted by ExogenZC
Посмотреть сообщение
Work, but I don't undestand that "return 1;" after SendClientMessage(playerid, COLOR_GREEN, "Price Between 20 and 999999");
Return 1; = Return true; //Enabled returning
if there is
Return 0; = Return false; //Disabled returning
Reply
#5

Ok, Thanks!
Reply
#6

try this one

CMD:chouse(playerid, params[])
{
new price;
new interior;
if(sscanf(params, "i", price)) return SendClientMessage(playerid, COLOR_RED, "Usage: /chouse <Prezzo>");
new Float: pX;
new Float: pY;
new Float: pZ;
GetPlayerPos(playerid, pX, pY, pZ);

if(price < 20 && price > 99999) return SendClientMessage(playerid, COLOR_GREEN, "Price Between 20 and 999999");
{
SendClientMessage(playerid, COLOR_GREEN, "Ok");
}
return 1;
}
Reply
#7

The problem is your &&-operator, you need the ||-operator:
PHP код:
 if(price 20 && price 99999
to
PHP код:
 if(price 20 || price 99999
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)