[Scripting Help] Hitman Skills
#1

Hi, am new to scripting to knew a few stuff but i got at points i don't know what to do or where to start..
The script that am using has an /sethitman system so Admin can give players hit man skills to all weapons but i wanna change it around..like i want to /sethitman to only sawnoff's, 9mm and UZI/Tec9 and all other skills dont need to be set by using /sethitman.....
(it's kinda hard to explain what i really want but i tired)

Код:
CMD:sethitman(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] <= 1339 && PlayerInfo[playerid][pShopTech] == 0) return Error(playerid, "You are not authorized to use this command.");
	new giveplayerid, choice[32], string[128];
	if(sscanf(params, "is[32]", giveplayerid, choice))
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /sethitman [playerid] [weapon]");
		SendClientMessageEx(playerid, COLOR_GRAD2, "Available names: 9mm, Silenced, Deagle, Shotgun, Sawnoff, Spas12, Uzi, MP5, M4, AK47");
		return 1;
	}
		
	if(strcmp(choice, "9mm", true) == 0)
	{
		if(PlayerInfo[giveplayerid][p9mmSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][p9mmSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_PISTOL, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the 9mm",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the 9mm",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][p9mmSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_PISTOL, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the 9mm",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the 9mm",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "silenced", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pSilencedSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pSilencedSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_PISTOL_SILENCED, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the Silenced Pistol",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the Silenced Pistol",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pSilencedSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_PISTOL_SILENCED, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the Silenced Pistol",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the Silenced Pistol",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "deagle", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pDeagleSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pDeagleSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_DESERT_EAGLE, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the Deagle",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the Deagle",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pDeagleSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_DESERT_EAGLE, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the Deagle",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the Deagle",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "shotgun", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pShotgunSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pShotgunSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_SHOTGUN, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the Shotgun",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pShotgunSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_SHOTGUN, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the Shotgun",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "sawnoff", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pSawnoffSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pSawnoffSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pSawnoffSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "spas12", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pSpasSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pSpasSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_SPAS12_SHOTGUN, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the Spas-12",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the Spas-12",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pSpasSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_SPAS12_SHOTGUN, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the Spas-12",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the Spas-12",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "uzi", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pUziSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pUziSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_MICRO_UZI, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the UZI",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the UZI",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pUziSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_MICRO_UZI, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the UZI",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the UZI",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "mp5", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pMp5Skill] == 1)
		{
		 	PlayerInfo[giveplayerid][pMp5Skill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_MP5, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the MP5",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the MP5",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pMp5Skill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_MP5, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the MP5",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the MP5",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "ak47", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pAKSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pAKSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_AK47, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the AK-47",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the AK-47",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pAKSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_AK47, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the AK-47",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the AK-47",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	if(strcmp(choice, "m4", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pM4Skill] == 1)
		{
		 	PlayerInfo[giveplayerid][pM4Skill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_M4, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the M4",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the M4",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pM4Skill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_M4, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the M4",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the M4",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	OnPlayerStatsUpdate(giveplayerid);
	return 1;
}




To something like this








CMD:sethitman(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] <= 1339 && PlayerInfo[playerid][pShopTech] == 0) return Error(playerid, "You are not authorized to use this command.");
	new giveplayerid, choice[32], string[128];
	if(sscanf(params, "is[32]", giveplayerid, choice))
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /sethitman [playerid] [weapon]");
		SendClientMessageEx(playerid, COLOR_GRAD2, "Available names: 9mm, Sawnoff, Uzi");
		return 1;
	}
		
	if(strcmp(choice, "9mm", true) == 0)
	{
		if(PlayerInfo[giveplayerid][p9mmSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][p9mmSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_PISTOL, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the 9mm",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the 9mm",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][p9mmSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_PISTOL, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the 9mm",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the 9mm",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}

	if(strcmp(choice, "sawnoff", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pSawnoffSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pSawnoffSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pSawnoffSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}


	if(strcmp(choice, "uzi", true) == 0)
	{
		if(PlayerInfo[giveplayerid][pUziSkill] == 1)
		{
		 	PlayerInfo[giveplayerid][pUziSkill] = 0;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_MICRO_UZI, 400);
			format(STRING, "AdmCmd: %s has taken %s's hitman skill on the UZI",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has taken your hitman skill on the UZI",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
		else
		{
			PlayerInfo[giveplayerid][pUziSkill] = 1;
			SetPlayerSkillLevel(giveplayerid, WEAPONSKILL_MICRO_UZI, 999);
			format(STRING, "AdmCmd: %s has given %s hitman skill on the UZI",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
			SendAdminMessage(COLOR_LIGHTRED, string);
			Log("logs/csr.log", string);
			format(STRING, "Admin %s has given you hitman skill on the UZI",GetPlayerNameEx(playerid));
			SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
		}
	}
	
	}
	OnPlayerStatsUpdate(giveplayerid);
	return 1;
}
Reply
#2

Look up tutorials and integrate SSCANF in your script.
Reply
#3

Do you mean the player skill level? https://sampwiki.blast.hk/wiki/SetPlayerSkillLevel

Maybe post your attempt so maybe we can understand and help you
Reply
#4

Quote:
Originally Posted by FailerZ
Посмотреть сообщение
Do you mean the player skill level? https://sampwiki.blast.hk/wiki/SetPlayerSkillLevel

Maybe post your attempt so maybe we can understand and help you
i edited it maybe u can understand now i guess
Reply
#5

take it

PHP код:
CMD:sethitman(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] <= 1339 && PlayerInfo[playerid][pShopTech] == 0) return Error(playerid"You are not authorized to use this command.");
    new 
giveplayeridchoice[32], string[128];
    if(
sscanf(params"is[32]"giveplayeridchoice))
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"USAGE: /sethitman [playerid] [weapon]");
        
SendClientMessageEx(playeridCOLOR_GRAD2"Available names: 9mm, Sawnoff, Uzi");
        return 
1;
    }
    if(
strcmp(choice"9mm"true) == 0)
    {
        if(
PlayerInfo[giveplayerid][p9mmSkill] == 1)
        {
             
PlayerInfo[giveplayerid][p9mmSkill] = 0;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_PISTOL400);
            
format(STRING"AdmCmd: %s has taken %s's hitman skill on the 9mm",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has taken your hitman skill on the 9mm",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
        else
        {
            
PlayerInfo[giveplayerid][p9mmSkill] = 1;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_PISTOL999);
            
format(STRING"AdmCmd: %s has given %s hitman skill on the 9mm",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has given you hitman skill on the 9mm",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
    }
    if(
strcmp(choice"sawnoff"true) == 0)
    {
        if(
PlayerInfo[giveplayerid][pSawnoffSkill] == 1)
        {
             
PlayerInfo[giveplayerid][pSawnoffSkill] = 0;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_SAWNOFF_SHOTGUN400);
            
format(STRING"AdmCmd: %s has taken %s's hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has taken your hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
        else
        {
            
PlayerInfo[giveplayerid][pSawnoffSkill] = 1;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_SAWNOFF_SHOTGUN999);
            
format(STRING"AdmCmd: %s has given %s hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has given you hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
    }
    if(
strcmp(choice"uzi"true) == 0)
    {
        if(
PlayerInfo[giveplayerid][pUziSkill] == 1)
        {
             
PlayerInfo[giveplayerid][pUziSkill] = 0;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_MICRO_UZI400);
            
format(STRING"AdmCmd: %s has taken %s's hitman skill on the UZI",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has taken your hitman skill on the UZI",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
        else
        {
            
PlayerInfo[giveplayerid][pUziSkill] = 1;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_MICRO_UZI999);
            
format(STRING"AdmCmd: %s has given %s hitman skill on the UZI",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has given you hitman skill on the UZI",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
    }
    
OnPlayerStatsUpdate(giveplayerid);
    return 
1;

Reply
#6

If I understand, You want to reset all the weapon skills for the player then set the one chosen in the command..
If that you can use a loop like this whenever the command is used:
PHP код:
 for(new i<= 10i++) SetPlayerSkillLevel(playeridi0); //According to samp wiki from 0 to 10 all the skills 
Then set the player skill level to the one chosen with the command.

Or better is to save the last chosen skill on that player and only reset it without resetting the rest >> [This is more effective]
Reply
#7

Quote:
Originally Posted by FailerZ
Посмотреть сообщение
If I understand, You want to reset all the weapon skills for the player then set the one chosen in the command..
If that you can use a loop like this whenever the command is used:
PHP код:
 for(new i<= 10i++) SetPlayerSkillLevel(playeridi0); //According to samp wiki from 0 to 10 all the skills 
Then set the player skill level to the one chosen with the command.

Or better is to save the last chosen skill on that player and only reset it without resetting the rest >> [This is more effective]

he want to remove other skill options from choice of command like 9mm, sawnoff, uzi etc..
Reply
#8

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
take it

PHP код:
CMD:sethitman(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] <= 1339 && PlayerInfo[playerid][pShopTech] == 0) return Error(playerid"You are not authorized to use this command.");
    new 
giveplayeridchoice[32], string[128];
    if(
sscanf(params"is[32]"giveplayeridchoice))
    {
        
SendClientMessageEx(playeridCOLOR_GRAD1"USAGE: /sethitman [playerid] [weapon]");
        
SendClientMessageEx(playeridCOLOR_GRAD2"Available names: 9mm, Sawnoff, Uzi");
        return 
1;
    }
    if(
strcmp(choice"9mm"true) == 0)
    {
        if(
PlayerInfo[giveplayerid][p9mmSkill] == 1)
        {
             
PlayerInfo[giveplayerid][p9mmSkill] = 0;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_PISTOL400);
            
format(STRING"AdmCmd: %s has taken %s's hitman skill on the 9mm",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has taken your hitman skill on the 9mm",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
        else
        {
            
PlayerInfo[giveplayerid][p9mmSkill] = 1;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_PISTOL999);
            
format(STRING"AdmCmd: %s has given %s hitman skill on the 9mm",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has given you hitman skill on the 9mm",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
    }
    if(
strcmp(choice"sawnoff"true) == 0)
    {
        if(
PlayerInfo[giveplayerid][pSawnoffSkill] == 1)
        {
             
PlayerInfo[giveplayerid][pSawnoffSkill] = 0;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_SAWNOFF_SHOTGUN400);
            
format(STRING"AdmCmd: %s has taken %s's hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has taken your hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
        else
        {
            
PlayerInfo[giveplayerid][pSawnoffSkill] = 1;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_SAWNOFF_SHOTGUN999);
            
format(STRING"AdmCmd: %s has given %s hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has given you hitman skill on the Sawnoff Shotgun",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
    }
    if(
strcmp(choice"uzi"true) == 0)
    {
        if(
PlayerInfo[giveplayerid][pUziSkill] == 1)
        {
             
PlayerInfo[giveplayerid][pUziSkill] = 0;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_MICRO_UZI400);
            
format(STRING"AdmCmd: %s has taken %s's hitman skill on the UZI",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has taken your hitman skill on the UZI",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
        else
        {
            
PlayerInfo[giveplayerid][pUziSkill] = 1;
            
SetPlayerSkillLevel(giveplayeridWEAPONSKILL_MICRO_UZI999);
            
format(STRING"AdmCmd: %s has given %s hitman skill on the UZI",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            
SendAdminMessage(COLOR_LIGHTREDstring);
            
Log("logs/csr.log"string);
            
format(STRING"Admin %s has given you hitman skill on the UZI",GetPlayerNameEx(playerid));
            
SendClientMessageEx(giveplayeridCOLOR_WHITEstring);
        }
    }
    
OnPlayerStatsUpdate(giveplayerid);
    return 
1;

So all the skills are set auto apart from UZI, sawnoff's and 9mm?
Reply
#9

when you use /sethitman playerid 9mm it will set or remove 9mm skill same like if you use another option it will works.
Reply
#10

I coded an entirely more efficient command for you. It could be even more efficient as to how it grabs the weapon choice typed and deals with it, but, I figured I'd keep it simple so you can understand it.

This also makes it super simple to add more weapons in the future if need be.

If you have any questions, just let me know. I can explain any part of the command I did.

Код:
CMD:sethitman( playerid, params[] ) {

	new
		targetID,
		targetName[MAX_PLAYER_NAME],
		adminName[MAX_PLAYER_NAME],
		weaponChoice[16],
		adminMessage[128],
		playerMessage[128],
		weaponSkillsGiven = 0
	;

	//Checks

	if ( PlayerInfo[playerid][pAdmin] <= 1339 && PlayerInfo[playerid][pShopTech] == 0 )
		return Error( playerid, "You are not authorized to use this command." );

	if ( sscanf( params, "is[16]", targetID, weaponChoice ) ) {

		SendClientMessage( playerid, COLOR_GRAD1, "USAGE: /sethitman [playerid] [weapon]" );
		SendClientMessage( playerid, COLOR_GRAD2, "Available Weapons: 9mm, sawnoff, uzi" );
		return 1;

	}

	//Weapon Choices

	if ( strcmp( weaponChoice, "9mm", true ) == 0 ) {

		PlayerInfo[targetID][p9mmSkill] = 0;
		SetPlayerSkillLevel( targetID, WEAPONSKILL_PISTOL, 400 );

	} else {

		PlayerInfo[playerid][p9mmSkill] = 1;
		SetPlayerSkillLevel( targetID, WEAPONSKILL_PISTOL, 999 );
		weaponSkillsGiven = 1;

	}

	if ( strcmp( weaponChoice, "sawnoff", true ) == 0 ) {

		PlayerInfo[targetID][pSawnoffSkill] = 0;
		SetPlayerSkillLevel( targetID, WEAPONSKILL_SAWNOFF_SHOTGUN, 400 );

	} else {

		PlayerInfo[playerid][pSawnoffSkill] = 1;
		SetPlayerSkillLevel( targetID, WEAPONSKILL_SAWNOFF_SHOTGUN, 999 );
		weaponSkillsGiven = 1;

	}

	if ( strcmp( weaponChoice, "uzi", true ) == 0 ) {

		PlayerInfo[targetID][pUziSkill] = 0;
		SetPlayerSkillLevel( targetID, WEAPONSKILL_MICRO_UZI, 400 );

	} else {

		PlayerInfo[playerid][pUziSkill] = 1;
		SetPlayerSkillLevel( targetID, WEAPONSKILL_MICRO_UZI, 999 );
		weaponSkillsGiven = 1;

	}

	//Messages

	if ( weaponSkillsGiven == 0 ) {

		format( adminMessage, sizeof( adminMessage ), "AdmCmd: %s has taken %s's hitman skill on the %s.", adminName, targetName, weaponChoice );
		format( playerMessage, sizeof( playerMessage ), "Admin %s has taken your hitman skill on the %s.", adminName, weaponChoice );

	} else {

		format( adminMessage, sizeof( adminMessage ), "AdmCmd: %s gave %s hitman skill on the %s.", adminName, targetName, weaponChoice );
		format( playerMessage, sizeof( playerMessage ), "Admin %s has given you hitman skill on the %s.", adminName, weaponChoice );

	}

	//Messages being Sent & Logged

	Log( "logs/csr.log", adminMessage );
	SendAdminMessage( COLOR_LIGHTRED, adminMessage );
	SendClientMessage( targetID, COLOR_WHITE, playerMessage );
	OnPlayerStatsUpdate( targetID );

	return 1;

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)