SA-MP Forums Archive
Loading a string with Dini? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Loading a string with Dini? (/showthread.php?tid=270016)



Loading a string with Dini? - lawonama - 18.07.2011

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


Re: Loading a string with Dini? - Adil - 18.07.2011

Misunderstood...


Re: Loading a string with Dini? - lawonama - 18.07.2011

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



Re: Loading a string with Dini? - eDz0r - 18.07.2011

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;
}



Re: Loading a string with Dini? - park4bmx - 18.07.2011

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


Re: Loading a string with Dini? - DeadAhead - 18.07.2011

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);


Re: Loading a string with Dini? - lawonama - 18.07.2011

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,


Re: Loading a string with Dini? - Fj0rtizFredde - 18.07.2011

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"));



Re: Loading a string with Dini? - lawonama - 18.07.2011

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



Re: Loading a string with Dini? - lawonama - 18.07.2011

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