SA-MP Forums Archive
Setting skin for gender - 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: Setting skin for gender (/showthread.php?tid=471872)



Setting skin for gender - Alex_T - 25.10.2013

pawn Код:
else if (dialogid == 3)//Sex
    {
        if(!response) return ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Rigester", "Male \nFemale", "Ok", "Leave");

        new name[MAX_PLAYER_NAME], file[50];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);

        if (listitem == 0) dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender] = 0);
        if (listitem == 0) SetPlayerSkin(playerid, 285);
        if (listitem == 0) PlayerInfo[playerid][pSkin] = 285;
        ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Where are you from?", "Los Santos \n San Fierro \n Las Venturas", "Ok", "Leave");
        if (listitem == 1) dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender] = 1);
        if (listitem == 1) SetPlayerSkin(playerid, 55);
        if (listitem == 1) PlayerInfo[playerid][pSkin] = 55;
        ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Where are you from?", "Los Santos \n San Fierro \n Las Venturas", "Ok", "Leave");
    }

Please tell me how I can set skin for each gender...


Will rep+++++


Re: Setting skin for gender - SilentSoul - 25.10.2013

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pGender] == 0) SetPlayerSkin(playerid,285);
    else if (PlayerInfo[playerid][pGender] == 1) SetPlayerSkin(playerid,55);
    return 1;
}



Re: Setting skin for gender - Alex_T - 25.10.2013

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pGender] == 0) SetPlayerSkin(playerid,285);
    else if (PlayerInfo[playerid][pGender] == 1) SetPlayerSkin(playerid,55);
    return 1;
}
If I use this, They will spawn with that skin every time they join the game. I just want it for when they finish registration


Re: Setting skin for gender - SilentSoul - 25.10.2013

pawn Код:
if (dialogid == 3)
    {
        if(response)
        {
         
            if(listitem == 0)
            {
               dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender] = 0) && SetPlayerSkin(playerid, 285) && PlayerInfo[playerid][pSkin] = 285;
            }
            if(listitem == 1)
            {
               dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender] = 1) && SetPlayerSkin(playerid, 55) && PlayerInfo[playerid][pSkin] = 55;
            }
        }
        return 1;
    }



Re: Setting skin for gender - Alex_T - 25.10.2013

Now I am getting an error

pawn Код:
error 022: must be lvalue (non-constant)
Error is on both lines in between the if statement


Re: Setting skin for gender - Alex_T - 25.10.2013

Could someone help please


Re: Setting skin for gender - KevinPRINCE - 25.10.2013

@Alex make a .ini file where the skin id is saved as a variable, then make another function like
Код:
public OnPlayerSpawn(playerid)
{
    if(PlayerInfo[playerid][pGender] == 0) SetPlayerSkin(playerid,[Whatever Variable In the .ini file]);
    else if (PlayerInfo[playerid][pGender] == 1) SetPlayerSkin(playerid,[Whatever Variable In the .ini file]);
    return 1;
}
Also make sure to open all the dini files in a public code or else you will have to open it in all functions


Re: Setting skin for gender - SilentSoul - 25.10.2013

I didn't copy from other gamemode or someother guys script but i ain't use dini before.


Re: Setting skin for gender - KevinPRINCE - 25.10.2013

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
I didn't copy from other gamemode or someother guys script but i ain't use dini before.
Sorry I didn't read the full code read my edit


Re: Setting skin for gender - Threshold - 25.10.2013

Do you want these skins to be random every time?

EDIT: I will be able to make an array with female and male skins if you need random skins. Then you can just save them to a playerfile to have them load the next time the login, rather than them getting a new random skin.