SA-MP Forums Archive
help code - 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 code (/showthread.php?tid=474013)



help code - 26_RUSSS - 05.11.2013

help my code please
Код:
new str[57];
format(str, sizeof(str), "OrganizationInfo[%d][Skin%d]", idorg, playerInfo[playerid][pRank]);
SetPlayerSkin(playerid, str);
error
Код:
error 035: argument type mismatch (argument 2)



Re: help code - Konstantinos - 05.11.2013

The second parameter of SetPlayerSkin is an integer. You can convert a string to an integer by using strval; however, you cannot do that with the str because of its text.

So what do you want to do?


Re: help code - 26_RUSSS - 05.11.2013

I want to do that would be based on the rank of the player to give the skin that is stored in my database.


Re: help code - Konstantinos - 05.11.2013

You'll need to make a function for it to easier set the skin.

For example:
pawn Код:
stock ReturnRankSkin( rank )
{
    new
        skinid
    ;
    switch( rank )
    {
        case 0: skinid = 269;
        case 1: skinid = 270;
        default: skinid = 1;
    }
    return skinid;
}
If the rank is 0, then it returns 269.
Else if the rank is 1, then it returns 270.
Else it returns 1.

You can modify it to your needs, that was just an example.
pawn Код:
SetPlayerSkin(playerid, ReturnRankSkin(playerInfo[playerid][pRank]));



Re: help code - 26_RUSSS - 05.11.2013

thanks