SA-MP Forums Archive
Switch,Case - 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: Switch,Case (/showthread.php?tid=602465)



Switch,Case - K0P - 07.03.2016

It sets the player team when the player selects a terrorists skin but it does not work or counter-terrorists

Код:
#define TERRORISTS 0
#define C_TERRORISTS 1
Код:
switch(classid)
{
    case 73,121,122,179,254:
    {
	Team[playerid] = TERRORISTS;
	SetPlayerColor(playerid, COLOR_RED);
	return 1;
    }
    case 284,285,287,280:
    {
        Team[playerid] = C_TERRORISTS;
	SetPlayerColor(playerid, COLOR_BLUE);
	return 1;
    }
}



Re: Switch,Case - Jefff - 07.03.2016

classid is not skinid, switch(GetPlayerSkin(playerid))


Re: Switch,Case - Banditul18 - 07.03.2016

You can make it with addplayerclass ,not with skins
Код:
public OnGameModeInit() 
{ 

	AddPlayerClass(258, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // case 0
	AddPlayerClass(202, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // case 1
	AddPlayerClass(198, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // case 2
	AddPlayerClass(261, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // case 3
    return 1; 
}
public OnPlayerRequestClass(playerid, classid)
{
	switch (classid)
	{
		case 0, 1: // terrorist
		{
			//code
		}
                case 2, 3://C-Terorist
                {
                      //code
                }
	}
	
	return 1;
}