Jump to content
  • 0

pomoc Dialog (inputtext)


bboyadams

Dotaz

ZDravím, mám problém s dialogem.. mám nastavené, že pokud napíše id větší než 286 nebo menší než 0, tak mu to vyhodí dialog, že rozmezí 0-286 . Ale když zadám ve hře do dialogu číslo třeba 656 , tak hra spadne, myslím že pouze mě, ne celý server, ale i tak. Děkuji za pomoc.

 

 

if(response == 1)
{
if(strlen(inputtext) > 286 || strlen(inputtext) < 0) return ShowPlayerDialog(playerid,999,DIALOG_STYLE_INPUT,"Skin","{FF0000}Rozmezí skinu 0-286\n{FFFFFF}Napiš ID skinu:","Potvrdit","Konec"); SetTimerEx("IsPlayerInPickupFalse",2000,0,"i",playerid);
if(ZjistitHraciPenize(playerid) < 2000) return FormatPlayerInfoBox(playerid,"~r~POZOR","~w~Nemas dostatek penez na skin (2000$)",5000); SetTimerEx("IsPlayerInPickupFalse",2000,0,"i",playerid);
 
SetPlayerSkin(playerid,strval(inputtext));
DatHraciPenize(playerid, -2000);
PlayerPlaySound(playerid,4201,0,0,0);
new string[18];
format(string, sizeof(string), "[ ! ] Koupil sis skin ID: %d.",GetPlayerSkin(playerid));
SetTimerEx("IsPlayerInPickupFalse",2000,0,"i",playerid);
}
 
if(response == 0)
{
   SetTimerEx("IsPlayerInPickupFalse",2000,0,"i",playerid);
}
}
Link to comment
Share on other sites

2 odpovědí na tuto otázku

Recommended Posts

  • 0
if(strlen(inputtext) > 286 || strlen(inputtext) < 0) return ...

Funkce strlen vrací počet znamének v řetězci, nikoliv int hodnotu z řetězce. Měl by jsi tam místo funkce strlen použít funkci strval - stejně jako to máš zde: SetPlayerSkin(playerid,strval(inputtext));

Jestli jsem teda správně pochopil, jak má ta podmínka fungovat.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...