Random Skins
#1

Is there a better way to do this? It works fine, but any better way of doing it and I'll be super grateful!
Code checks at OnAccountLoad whether they are male or female, and have the skin ID under 1. If so, it'll generate three random skins if male, and three if female. Else, it will load normal skin from the database.

Код:
new MaleSkins[][4] =
{
	{6}, // Emmet
	{29}, // Drug Dealer
	{48} // hmyst
};

new FemaleSkins[][4] =
{
	{40}, // Normal Ped
	{41}, // Normal Ped
	{56} // Normal Ped
};
Код:
    if(!strcmp(Player[playerid][Gender], "Male") && Player[playerid][Skin] < 1)
	{
	    new rand = random(sizeof(MaleSkins));
		SetSpawnInfo(playerid, 0, MaleSkins[rand][0], Player[playerid][posX], Player[playerid][posY], Player[playerid][posZ], Player[playerid][posA], 0, 0, 0, 0, 0, 0);
		Player[playerid][Skin] = GetPlayerSkin(playerid);
	}
 	else if(!strcmp(Player[playerid][Gender], "Female") && Player[playerid][Skin] < 1)
	{
 		new rand = random(sizeof(FemaleSkins));
		SetSpawnInfo(playerid, 0, FemaleSkins[rand][0], Player[playerid][posX], Player[playerid][posY], Player[playerid][posZ], Player[playerid][posA], 0, 0, 0, 0, 0, 0);
		Player[playerid][Skin] = GetPlayerSkin(playerid);
	}
	else
	{
 		Player[playerid][Skin] = cache_get_field_content_int(0, "Skin");
		SetSpawnInfo(playerid, 0, Player[playerid][Skin], Player[playerid][posX], Player[playerid][posY], Player[playerid][posZ], Player[playerid][posA], 0, 0, 0, 0, 0, 0);
	}
   	SpawnPlayer(playerid);
Reply


Messages In This Thread
Random Skins - by Allura - 06.08.2016, 11:45
Re: Random Skins - by Konstantinos - 06.08.2016, 11:56
Re: Random Skins - by Allura - 06.08.2016, 13:02
Re: Random Skins - by Konstantinos - 06.08.2016, 13:06

Forum Jump:


Users browsing this thread: 1 Guest(s)