SA-MP Forums Archive
Skin Arrays - 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: Skin Arrays (/showthread.php?tid=620476)



Skin Arrays - vassilis - 30.10.2016

Can i make an array of skin ID's so if a player press left/right td it will chang accordingly to the next or previous skin?
Example i have some skins. Do i implement them like that?
PHP код:
new CivilianSkins[7] = {1510 ,223366108}; 
Or there is another? Way?
Also..
PHP код:
if( clickedid == TDLEFT)
{
 
//How i can make it so skin changes to previous if he presses left?
}
else if(
clickedid == TDRIGHT)
{
//Same but in pressing right

How can i implement this?


Re: Skin Arrays - NeXoR - 30.10.2016

Код:
CurrentSkin = Current CivillianSkin[] being viewed at the moment
PHP код:
if( clickedid == TDLEFT

    if(
CurrentSkin-- < 0ShowSkinTextDraw(CivilianSkin[sizeof(CivillianSkin)]);
    else 
ShowSkinTextDraw(CivillianSkin[CurrentSkin--]);

else if(
clickedid == TDRIGHT

    if(
CurrentSkin++ > sizeof(CivillianSkin)) ShowSkinTextDraw(CivilianSkin[0]);
    else 
ShowSkinTextDraw(CivillianSkin[CurrentSkin++]);

Match it to your gamemode ...


Re: Skin Arrays - vassilis - 30.10.2016

I don't really think that's correct.


Re: Skin Arrays - justice96 - 30.10.2016

Код:
static const CivilianSkins[7] =
{
	1, 5, 10 ,22, 33, 66, 108
};

new SelectedSkin[MAX_PLAYERS];

if( clickedid == TDLEFT) 
{ 
	SelectedSkin[playerid]++;
    if(SelectedSkin[playerid] >= 285)
    {
        SelectedSkin[playerid] = 0;
    }
    SetPlayerSkin(playerid,CivilianSkins[SelectedSkin[playerid]]);
} 

else if(clickedid == TDRIGHT) 
{ 
	SelectedSkin[playerid]--;
	if(SelectedSkin[playerid] == -1)
	{
        SelectedSkin[playerid] = 284;
	}
	SetPlayerSkin(playerid,CivilianSkins[SelectedSkin[playerid]]);
}

// if the player choose a skin and pressed spawn
if(PRESSED(bla bla))
{
	PlayerInfo[playerid][Skin] = GetPlayerSkin(playerid);
    SelectedSkin[playerid] = 0;
	SpawnPlayer(playerid);
}



Re: Skin Arrays - vassilis - 30.10.2016

Forgot to mention that i already solved before. Thank you justice for help though.