Skin selector, little problem..
#1

Hey,

I made a skin selector because I want each team to choose from there own 3 skins (Grove's 3 grove skins, Ballas 3 ballas skins, etc.).
Almost everything works, but when I press left or right it stays on skin 1, can somebody see what's wrong?

Greets Tom.

http://pastebin.com/m3c974786

Or:

Code:
ClassSel_SetupSelectedSkin(playerid) //Setup for when you choose your skin (camera,positions etc.)
{
	if(gPlayerSkinSelection[playerid] == -1) {
		gPlayerSkinSelection[playerid] = SKIN_1;
	}

	if(gPlayerGangSelection[playerid] == GANG_GROVE) {

		if(gPlayerSkinSelection[playerid] == SKIN_1) {
			SetPlayerSkin(playerid, 105);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawShowForPlayer(playerid,txtSkin1);
			TextDrawHideForPlayer(playerid,txtSkin2);
			TextDrawHideForPlayer(playerid,txtSkin3);
		}
		else if(gPlayerSkinSelection[playerid] == SKIN_2) {
	 		SetPlayerSkin(playerid, 106);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawHideForPlayer(playerid,txtSkin1);
			TextDrawShowForPlayer(playerid,txtSkin2);
			TextDrawHideForPlayer(playerid,txtSkin3);
		}
		else if(gPlayerSkinSelection[playerid] == SKIN_3) {
	 		SetPlayerSkin(playerid, 107);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawHideForPlayer(playerid,txtSkin1);
			TextDrawHideForPlayer(playerid,txtSkin2);
			TextDrawShowForPlayer(playerid,txtSkin3);
		}
	}

	else if(gPlayerGangSelection[playerid] == GANG_BALLAS) {

		if(gPlayerSkinSelection[playerid] == SKIN_1) {
			SetPlayerSkin(playerid, 102);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawShowForPlayer(playerid,txtSkin1);
			TextDrawHideForPlayer(playerid,txtSkin2);
			TextDrawHideForPlayer(playerid,txtSkin3);
		}
		else if(gPlayerSkinSelection[playerid] == SKIN_2) {
	 		SetPlayerSkin(playerid, 103);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawHideForPlayer(playerid,txtSkin1);
			TextDrawShowForPlayer(playerid,txtSkin2);
			TextDrawHideForPlayer(playerid,txtSkin3);
		}
		else if(gPlayerSkinSelection[playerid] == SKIN_3) {
	 		SetPlayerSkin(playerid, 104);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawHideForPlayer(playerid,txtSkin1);
			TextDrawHideForPlayer(playerid,txtSkin2);
			TextDrawShowForPlayer(playerid,txtSkin3);
		}
	}
	
	else if(gPlayerGangSelection[playerid] == GANG_AZTECAS) {

		if(gPlayerSkinSelection[playerid] == SKIN_1) {
			SetPlayerSkin(playerid, 114);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawShowForPlayer(playerid,txtSkin1);
			TextDrawHideForPlayer(playerid,txtSkin2);
			TextDrawHideForPlayer(playerid,txtSkin3);
		}
		else if(gPlayerSkinSelection[playerid] == SKIN_2) {
	 		SetPlayerSkin(playerid, 115);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawHideForPlayer(playerid,txtSkin1);
			TextDrawShowForPlayer(playerid,txtSkin2);
			TextDrawHideForPlayer(playerid,txtSkin3);
		}
		else if(gPlayerSkinSelection[playerid] == SKIN_3) {
	 		SetPlayerSkin(playerid, 116);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawHideForPlayer(playerid,txtSkin1);
			TextDrawHideForPlayer(playerid,txtSkin2);
			TextDrawShowForPlayer(playerid,txtSkin3);
		}
	}
	
	else if(gPlayerGangSelection[playerid] == GANG_VAGOS) {

		if(gPlayerSkinSelection[playerid] == SKIN_1) {
			SetPlayerSkin(playerid, 108);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawShowForPlayer(playerid,txtSkin1);
			TextDrawHideForPlayer(playerid,txtSkin2);
			TextDrawHideForPlayer(playerid,txtSkin3);
		}
		else if(gPlayerSkinSelection[playerid] == SKIN_2) {
	 		SetPlayerSkin(playerid, 109);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawHideForPlayer(playerid,txtSkin1);
			TextDrawShowForPlayer(playerid,txtSkin2);
			TextDrawHideForPlayer(playerid,txtSkin3);
		}
		else if(gPlayerSkinSelection[playerid] == SKIN_3) {
	 		SetPlayerSkin(playerid, 110);
			SetPlayerInterior(playerid,11);
			SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
			SetPlayerFacingAngle(playerid,0.0);
	  	SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
			SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);

			TextDrawHideForPlayer(playerid,txtSkin1);
			TextDrawHideForPlayer(playerid,txtSkin2);
			TextDrawShowForPlayer(playerid,txtSkin3);
		}
	}

}

//----------------------------------------------------------

ClassSel_SwitchToNextSkin(playerid)
{
  gPlayerSkinSelection[playerid]++;
	if(gPlayerSkinSelection[playerid] > SKIN_3) {
	  gPlayerSkinSelection[playerid] = SKIN_1;
	}
	PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
	gPlayerLastSkinSelectionTick[playerid] = GetTickCount();
	ClassSel_SetupSelectedSkin(playerid);
}

//----------------------------------------------------------

ClassSel_SwitchToPreviousSkin(playerid)
{
  gPlayerSkinSelection[playerid]--;
	if(gPlayerGangSelection[playerid] < SKIN_1) {
	  gPlayerSkinSelection[playerid] = SKIN_3;
	}
	PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
	gPlayerLastSkinSelectionTick[playerid] = GetTickCount();
	ClassSel_SetupSelectedSkin(playerid);
}

//-----------------------------------------------------------

ClassSel_HandleSkinSelection(playerid)
{
	new Keys,ud,lr;
  GetPlayerKeys(playerid,Keys,ud,lr);

  if(gPlayerSkinSelection[playerid] == -1) {
		ClassSel_SwitchToNextSkin(playerid);
		return;
	}

	// only allow new selection every ~500 ms
	if( (GetTickCount() - gPlayerLastSkinSelectionTick[playerid]) < 500 ) return;

	if(Keys & KEY_FIRE) {
	  gPlayerHasSkinSelected[playerid] = 1;
	  TextDrawHideForPlayer(playerid,txtSkinSelHelper);
		TextDrawHideForPlayer(playerid,txtSkin1);
		TextDrawHideForPlayer(playerid,txtSkin2);
		TextDrawHideForPlayer(playerid,txtSkin3);
	  TogglePlayerSpectating(playerid,0);
	  return;
	}

	if(lr > 0) {
	  ClassSel_SwitchToNextSkin(playerid);
	}
	else if(lr < 0) {
	  ClassSel_SwitchToPreviousSkin(playerid);
	}
}
Reply
#2

Nobody?
Reply
#3

Did you configure the left and right buttons for switching skins?
Reply
#4

It's in here right?

Code:
ClassSel_HandleSkinSelection(playerid)
{
	new Keys,ud,lr;
  GetPlayerKeys(playerid,Keys,ud,lr);

  if(gPlayerSkinSelection[playerid] == -1) {
		ClassSel_SwitchToNextSkin(playerid);
		return;
	}

	// only allow new selection every ~500 ms
	if( (GetTickCount() - gPlayerLastSkinSelectionTick[playerid]) < 500 ) return;

	if(Keys & KEY_FIRE) {
	  gPlayerHasSkinSelected[playerid] = 1;
	  TextDrawHideForPlayer(playerid,txtSkinSelHelper);
		TextDrawHideForPlayer(playerid,txtSkin1);
		TextDrawHideForPlayer(playerid,txtSkin2);
		TextDrawHideForPlayer(playerid,txtSkin3);
	  TogglePlayerSpectating(playerid,0);
	  return;
	}

	if(lr > 0) {
	  ClassSel_SwitchToNextSkin(playerid);
	}
	else if(lr < 0) {
	  ClassSel_SwitchToPreviousSkin(playerid);
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)