Class Selection
#1

I want to make class selection where you can choose almost all skins but I don't want to do AddPlayerClass() 200+ times. So I want to create like a variable where I can assign each skin a name like "Skin ID: 0 Name: CJ" "Skin ID: 2 Name: Civilian" so that when the player goes to that skin above it it says the name.
Reply
#2

Try this :

PHP код:
stock SkinSelection()
{
    
AddPlayerClass(01958.331343.1215.36269.1526362815000); // CJ
    //And you can add your skins
}
Under OnGameModeInit()
public 
OnGameModeInit()
{
     
SkinSelection();
     return 
1;

Reply
#3

Just perform a loop, and use the accumulator (usually 'i') as the skin id.
Reply
#4

PHP код:
for(new 0!= 311i++) AddPlayerClass(ixyzangle00000); // You need to change x, y, z and angle pos 
Reply
#5

I've tried this but is there a way for me to not use certain skins, like I dont want CJ so I can change i = 0 to i = 1 but what if I want to not use skin id 230 lets say?
Reply
#6

Код:
for(new i = 0; i != 311; i++) 
{
	switch (i)
	{
		case 0, 230: 
			continue;

		default:
			AddPlayerClass(i, x, y, z, angle, 0, 0, 0, 0, 0);
	}
}
Reply
#7

I dont know if this is something about my script but if I use that code (and J4Rr3x's code) it just shows CJ skin and I cant switch or spawn. Here's my whole code atm.

EDIT: I tried deleting the loop and change it just to AddPlayerClass(); but i still cant spawn.

Код:
#include <a_samp>

main()
{
	print("Loading A Second Life gamemode...");
}

stock AddClasses()
{
	for(new i = 0; i != 311; i++) 
	{
		switch (i)
		{
			case 0, 4: 
			continue;

			default:
			AddPlayerClass(i, 1544.2551, -1353.2411, 329.4744, 87.6617, 0, 0, 0, 0, 0, 0);
		}
	}
}

new Float:RandomSpawns[][] = 
{
	{2201.8760,-1161.0521,25.8780,272.5869}, // Jefferson Motel
	{2121.5967,-974.1371,57.7656,171.7050}, // Las Colinas
	{2375.6597,-1037.8004,54.1973,172.1514}, // Las Colinas
	{2428.9927,-1221.7167,25.4004,179.7292}, // The Pig Pen
	{2358.3992,-1365.8174,24.0213,265.7771}, // East Los Santos 
	{2400.4392,-1548.1301,24.1641,356.5128}, // East Los Santos
	{2422.0574,-1498.2944,23.9922,272.9773}, // Cluckin' Bell in East Los Santos
	{2236.6924,-1313.7605,23.9844,0.9249}, // Church in Jefferson
	{1992.1644,-1282.4811,23.9727,359.3238}, // Glen Park
	{1469.8098,-1278.2098,14.5625,87.8510}, // Downtown Los Santos
	{1463.2505,-1134.9756,24.0680,222.3933}, // Downtown Los Santos
	{1194.1259,-1026.3497,32.4620,176.3744}, // Temple
	{1117.3053,-923.9178,43.3906,176.6106}, // Temple
	{1193.6819,-891.5307,43.1568,1.7591} // Burger Shot in Mulholland
};

public OnGameModeInit()
{
	AddClasses();
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1544.2551, -1353.2411, 329.4744);
	SetPlayerFacingAngle(playerid, 87.6617);
	SetPlayerCameraPos(playerid, 1537.2468, -1352.9548, 329.4599);
	SetPlayerCameraLookAt(playerid, 1544.2551, -1353.2411, 329.4744);
}

public OnPlayerSpawn(playerid)
{
	new Random = random(sizeof(RandomSpawns));
	SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
    SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)