SA-MP Forums Archive
[HELP]: Inputtext - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]: Inputtext (/showthread.php?tid=456578)



[HELP]: Inputtext - Areax - 06.08.2013

Hello

Here is my problem...I tryed something like this:

pawn Код:
CMD:skin(playerid, params[])
{
    ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "{FF8000}Choose Your Skin:", "Type in an ID of a skin, you want to choose! (0 - 299)", "Choose", "");
    return 1;
}
And OnDialogResponse:

pawn Код:
if(dialogid == 6)
    {
    if(response == 1)
    {
    if(strlen(inputtext))
    {
    SetPlayerSkin(playerid, strlen(inputtext));
    }
    }
    }
But didn't work


Re: [HELP]: Inputtext - ACI - 06.08.2013

Lets try this: replace 'SetPlayerSkin(playerid, strlen(inputtext));' with 'SetPlayerSkin(playerid, inputtext);'


Re: [HELP]: Inputtext - Areax - 06.08.2013

pawn Код:
C:\.....\SA-MP\gamemodes\AvT.pwn(605) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: [HELP]: Inputtext - Konstantinos - 06.08.2013

Quote:
Originally Posted by ACI
Посмотреть сообщение
Lets try this: replace 'SetPlayerSkin(playerid, strlen(inputtext));' with 'SetPlayerSkin(playerid, inputtext);'
The second parameter of SetPlayerSkin function is integer and you insert a string which will give an error for argument type mismatch.

@Areax Is it a filterscript or gamemode?


Re: [HELP]: Inputtext - Lorrden - 06.08.2013

pawn Код:
if(strlen(inputtext) < 0 || strlen(inputtext) > 299) {
new id = inputtext;
return SetPlayerSkin(playerid, id);
}
Or you could use SSCANF to check that inputtext is a number.


Re: [HELP]: Inputtext - tyler12 - 06.08.2013

Use strval(inputtext) which extracts the numbers from the string.


Re: [HELP]: Inputtext - Areax - 06.08.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The second parameter of SetPlayerSkin function is integer and you insert a string which will give an error for argument type mismatch.

@Areax Is it a filterscript or gamemode?
Gamemode


Re: [HELP]: Inputtext - Areax - 06.08.2013

So, I tryied like this:

pawn Код:
if(dialogid == 6)
    {
    if(response == 1)
    {
    if(strval(inputtext) < 0 || strval(inputtext) > 299)
    {
    new skin = strval(inputtext);
    return SetPlayerSkin(playerid, skin);
    }
    }
    }
Didn't work


Re: [HELP]: Inputtext - Konstantinos - 06.08.2013

Do you return 1 in OnDialogResponse?


Re: [HELP]: Inputtext - Areax - 06.08.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Do you return 1 in OnDialogResponse?
Yea.