Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

[Scripting Help] Hitman Skills

$
0
0
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)

Code:

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;
}


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>