[HELP]: Inputtext
#1

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
Reply
#2

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

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.
Reply
#4

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?
Reply
#5

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.
Reply
#6

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

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
Reply
#8

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
Reply
#9

Do you return 1 in OnDialogResponse?
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)