SA-MP Forums Archive
HELP Command for Change Class HELP - 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: HELP Command for Change Class HELP (/showthread.php?tid=575612)



HELP Command for Change Class HELP - Charalambos26 - 28.05.2015

Hello I have these classes

Код HTML:
OnPlayerSpawn 
{ 
switch(gPlayerClass[playerid])
    {
        case ASSAULT:
        {
            TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
	        GivePlayerWeapon(playerid, 31, 200);//m4
	        GivePlayerWeapon(playerid, 29, 100);//mp5
	        GivePlayerWeapon(playerid, 27, 100);//  combat
	        GivePlayerWeapon(playerid, 24, 70);//deagle
        }
        case SNIPER:
        {
            TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
	        GivePlayerWeapon(playerid, 23, 200);//silent pistol
	        GivePlayerWeapon(playerid, 34, 250);//sniper
	        GivePlayerWeapon(playerid, 29, 250);//mp5
	        GivePlayerWeapon(playerid, 4, 1);//knife
	        RemovePlayerMapIcon(playerid, 0);
         	SetPlayerColor(playerid,COLOR_TRANSPARENT_MAP);
		}
	    case MEDIC:
		{
          	if(GetPlayerScore(playerid) >= 500){   // or if you have one variable  for scores PlayerInfo[playerid][score] >= 500 ...
          	TogglePlayerControllable(playerid, 1);
	  		ResetPlayerWeapons(playerid);
	 	    GivePlayerWeapon(playerid, 33, 200);
	  		GivePlayerWeapon(playerid, 22, 200);
	  		GivePlayerWeapon(playerid, 25, 200);
	  		GivePlayerWeapon(playerid, 11, 2);
          	}
          	else return SendClientMessage(playerid,-1,"You are not have 500+ scores for select this class");
			}
    }
return
But how to make a command which brings you to this selection?
NOTE THIS is not Team select! This is a class selection!!
Help mee


Re: HELP Command for Change Class HELP - FplayerGR - 28.05.2015

Код:
#define DIALOG_CLASSSELECT 3221



CMD:changeclass(playerid,params[]){
	#pragma unused params
	ShowPlayerDialog(playerid,DIALOG_CLASSSELECT,DIALOG_STYLE_LIST,"Select Class","ASSAULT\nSNIPER\nMEDIC","Select","exit");
	return 1;
}


ondialogresponse...

if(dialogid == DIALOG_CLASSSELECT){

	switch(listitem){
		case 0:{
			 TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
	        GivePlayerWeapon(playerid, 31, 200);//m4
	        GivePlayerWeapon(playerid, 29, 100);//mp5
	        GivePlayerWeapon(playerid, 27, 100);//  combat
	        GivePlayerWeapon(playerid, 24, 70);//deagle
		}
		case 1:{
		
			TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
	        GivePlayerWeapon(playerid, 23, 200);//silent pistol
	        GivePlayerWeapon(playerid, 34, 250);//sniper
	        GivePlayerWeapon(playerid, 29, 250);//mp5
	        GivePlayerWeapon(playerid, 4, 1);//knife
	        RemovePlayerMapIcon(playerid, 0);
         	SetPlayerColor(playerid,COLOR_TRANSPARENT_MAP);
		
		}
		case 2:{
		
			if(GetPlayerScore(playerid) >= 500){ 
          	TogglePlayerControllable(playerid, 1);
	  		ResetPlayerWeapons(playerid);
	 	    GivePlayerWeapon(playerid, 33, 200);
	  		GivePlayerWeapon(playerid, 22, 200);
	  		GivePlayerWeapon(playerid, 25, 200);
	  		GivePlayerWeapon(playerid, 11, 2);
          	}
          	else{ 
			SendClientMessage(playerid,-1,"You are not have 500+ score for select this class.");
			return ShowPlayerDialog(playerid,DIALOG_CLASSSELECT,DIALOG_STYLE_LIST,"Select Class","ASSAULT\nSNIPER\nMEDIC","Select","exit"); }
			}
		
		
		}
	
}
for /changeclass this?


Re: HELP Command for Change Class HELP - Charalambos26 - 28.05.2015

Quote:
Originally Posted by FplayerGR
Посмотреть сообщение
Код:
#define DIALOG_CLASSSELECT 3221



CMD:changeclass(playerid,params[]){
	#pragma unused params
	ShowPlayerDialog(playerid,DIALOG_CLASSSELECT,DIALOG_STYLE_LIST,"Select Class","ASSAULT\nSNIPER\nMEDIC","Select","exit");
	return 1;
}


ondialogresponse...

if(dialogid == DIALOG_CLASSSELECT){

	switch(listitem){
		case 0:{
			 TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
	        GivePlayerWeapon(playerid, 31, 200);//m4
	        GivePlayerWeapon(playerid, 29, 100);//mp5
	        GivePlayerWeapon(playerid, 27, 100);//  combat
	        GivePlayerWeapon(playerid, 24, 70);//deagle
		}
		case 1:{
		
			TogglePlayerControllable(playerid, 1);
	        ResetPlayerWeapons(playerid);
	        GivePlayerWeapon(playerid, 23, 200);//silent pistol
	        GivePlayerWeapon(playerid, 34, 250);//sniper
	        GivePlayerWeapon(playerid, 29, 250);//mp5
	        GivePlayerWeapon(playerid, 4, 1);//knife
	        RemovePlayerMapIcon(playerid, 0);
         	SetPlayerColor(playerid,COLOR_TRANSPARENT_MAP);
		
		}
		case 2:{
		
			if(GetPlayerScore(playerid) >= 500){ 
          	TogglePlayerControllable(playerid, 1);
	  		ResetPlayerWeapons(playerid);
	 	    GivePlayerWeapon(playerid, 33, 200);
	  		GivePlayerWeapon(playerid, 22, 200);
	  		GivePlayerWeapon(playerid, 25, 200);
	  		GivePlayerWeapon(playerid, 11, 2);
          	}
          	else{ 
			SendClientMessage(playerid,-1,"You are not have 500+ score for select this class.");
			return ShowPlayerDialog(playerid,DIALOG_CLASSSELECT,DIALOG_STYLE_LIST,"Select Class","ASSAULT\nSNIPER\nMEDIC","Select","exit"); }
			}
		
		
		}
	
}
for /changeclass this?
not working :/


Re: HELP Command for Change Class HELP - Azula - 28.05.2015

just force spawn
you need to make SetSpawnInfo and SpawnPlayer