Skin Arrays
#1

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?
Reply
#2

Код:
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 ...
Reply
#3

I don't really think that's correct.
Reply
#4

Код:
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);
}
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)