Loading a string with Dini?
#1

I made something that you type your skin ID in a dialog, and he writes that with dini in the file. I tested it works, but i couldn't figure out how to set his skin to that number he wrote, I already tested the following but i wont work:
pawn Код:
if (dialogid == Skint)
{
        if(response)
        {
        if(!strlen(inputtext) || strlen(inputtext) >= 300 || strlen(inputtext) < 1) return ShowPlayerDialog(playerid, Skint, DIALOG_STYLE_INPUT, "Skin", "You can't choose that skin!", "Accept", "Cancel");
        dini_Set(archivo,"skin", inputtext);
        SetPlayerSkin(playerid, skin);
        }
        else
        {
          SendClientMessage(playerid, 0xFF0000FF, "You selected cancel, you you got kicked!");
          Kick(playerid);
        }
        return 1;
}
return 1;
}
Here: is my error.

Код:
...\Desktop\new.pwn(751) : error 035: argument type mismatch (argument 2)
Here: is my line 751.
pawn Код:
SetPlayerSkin(playerid, skin);
Thanks already for the helps
Reply
#2

Misunderstood...
Reply
#3

Still
pawn Код:
error 035: argument type mismatch (argument 2)
Reply
#4

try and see if it work

pawn Код:
if (dialogid == Skint)
{
if(response)
{
if(!strlen(inputtext) || strlen(inputtext) >= 300 || strlen(inputtext) < 1)
{
ShowPlayerDialog(playerid, Skint, DIALOG_STYLE_INPUT, "Skin", "You can't choose that skin!", "Accept", "Cancel");
return 1;
}
dini_Set(archivo, "skin", inputtext);
SetPlayerSkin(playerid, dini_Int(archivo, "skin"));
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "You selected cancel, you you got kicked!");
Kick(playerid);
}
return 1;
}
Reply
#5

I think it counts it as a string because of the inputtext
And that's why u get that
But could be wrong
Reply
#6

first off:



the problem you have is that skin is an integer, and it needs to be a string.

SKIN usually is the Skin ID, not the name.
Try this:

new str[10];
format(str,sizeof(str),"%d",skin);
dini_Set("archivo.txt",str,inputtext);
Reply
#7

Its already a string! I aint have problems with saving like i told.
Look:
Код:
User=Mike_Murpher
Password=4358734985789
admin=0
skin=170
tutorial=1
He wrties his skin ID in the dialog and that save thats OK! But how to Set his skin to the number he wrote!? Don't give me other scripts please that wont fix my errors.
@DeadAhead I tried that and still got the same error.
Код:
SetPlayerSkin(playerid, skin);
I need to fix this one,
Reply
#8

You could just save it as an integer & use strval.
pawn Код:
//Save:
dini_IntSet(archivo, "skin", strval(inputtext));
//Load:
SetPlayerSkin(playerid, dini_Int(archivo,"skin"));
Reply
#9

Omg fixed:
pawn Код:
SetPlayerSkin(playerid, skin[playerid]);
Reply
#10

Hmm my errors were gone but still my skin wont change :/, also tried the one of Fj0rtizFredde but still not working. Any help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)