SA-MP Forums Archive
CMD 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: CMD help. (/showthread.php?tid=557723)



CMD help. - DonMaraz - 14.01.2015

Hey guys..
I did this cmd and when im in HMA faction and typing
"/hsms" it says im not autorized.. but when im a normal player.. I can use /hsms.
Please help

Quote:

CMD:hsms(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == 6)
{
SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command!");
return 1;
}
if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not Hitman Agency member.");
return 1;
}

new string[128];
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hsms [mole text]");

format(string, sizeof(string), "SMS: %s, Sender: MOLE (555)",params);
SendClientMessageToAllEx(COLOR_YELLOW, string);
return 1;
}




Re: CMD help. - xVIP3Rx - 14.01.2015

That's because "PlayerInfo[playerid][pFaction] == 6", make sure 6 equal the faction id. and normal player id is different.


Re: CMD help. - DonMaraz - 14.01.2015

What is the player id ?


Re: CMD help. - DonMaraz - 14.01.2015

btw still its not help.. HMA faction id is 4 and I can't fix it..
anyone help plz?
+rep!


Re: CMD help. - DonMaraz - 14.01.2015

HELP!


Re: CMD help. - CodyHawkins - 14.01.2015

It's because when a hitman uses /hsms, they'll get this:
pawn Код:
if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
    {
        SendClientMessage(playerid,COLOR_WHITE, "You're not Hitman Agency member."); // <-- This
    return 1;
If they're in "faction 6", they'll get this:

pawn Код:
if(PlayerInfo[playerid][pFaction] == 6)
    {
        SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command!"); // <-- This
    return 1;
    }
So you basicly did so all factions except for faction 6 & 4 being able to use it. Also you have no function? What's the CMD supposed to do?

Change your code to this:
pawn Код:
CMD:hsms(playerid, params[])
    if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
    {
        // Here you write what the CMD does if used by a hitman member.
    }
    else
    {
        SendClientMessage(playerid,COLOR_WHITE, "You're not Hitman Agency member.");
    }
    return 1;
}



Re: CMD help. - DonMaraz - 14.01.2015

its like /mole but for hitmans..

and what to write here:
Quote:

CMD:hsms(playerid, params[])
if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
// Here you write what the CMD does if used by a hitman member. -- HERE
}
else
{
SendClientMessage(playerid,COLOR_WHITE, "You're not Hitman Agency member.");
}
return 1;
}

please edit the full script (( /hsms is /mole but for hitmans..))
Quote:

CMD:hsms(playerid, params[])
{
if(PlayerInfo[playerid][pFaction] == 6)
{
SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command!");
return 1;
}
if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not Hitman Agency member.");
return 1;
}

new string[128];
if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hsms [mole text]");

format(string, sizeof(string), "SMS: %s, Sender: MOLE (555)",params);
SendClientMessageToAllEx(COLOR_YELLOW, string);
return 1;
}




Re: CMD help. - CodyHawkins - 14.01.2015

pawn Код:
CMD:hsms(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
    {

        if ((!hsms))
        {
            SendClientMessageEx(playerid, COLOR_GRAD2, "Please try again later, HMA Mole can be submitted every ten minutes.");
            return 1;

        }
        new string[128];
        if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /hmole [contract text]");
        SetTimer("hMoleOn", hmoletimer, 0);hmole = 0;
        format(string, sizeof(string), "SMS: %s ((/contract)), Sender:HMA (#BLOCKED) ",params);
        SendClientMessageToAllEx(COLOR_YELLOW, string);
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You are not a member of the hitman agency!");
        return 1;
    }
    return 1;
}
There you go, finished, added a few things to improve it.


Re: CMD help. - DonMaraz - 15.01.2015

nah its not working.
I need to define hsms, hmole on hmoletimer..
I need to fix my cmd..


Re: CMD help. - CodyHawkins - 15.01.2015

Quote:
Originally Posted by DonMaraz
Посмотреть сообщение
nah its not working.
I need to define hsms, hmole on hmoletimer..
I need to fix my cmd..
Have you ever been scripting before?

pawn Код:
forward hMoleOn();
new hmole = 1;
new hmoletimer = 600000; // <-- = 10 minutes

CMD:hmole(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
    {

        if ((!hsms))
        {
            SendClientMessageEx(playerid, COLOR_GRAD2, "Please try again later, HMA Mole can be submitted every ten minutes.");
            return 1;

        }
        new string[128];
        if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /hmole [contract text]");
        SetTimer("hMoleOn", hmoletimer, 0);hmole = 0;
        format(string, sizeof(string), "SMS: %s ((/contract)), Sender:HMA (#BLOCKED) ",params);
        SendClientMessageToAllEx(COLOR_YELLOW, string);
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "ERROR: You are not a member of the hitman agency!");
        return 1;
    }
    return 1;
}

public hMoleOn()
{
    hmole=1;
    return 1;
}
Here's all of it.
If it doesn't work, show me the warnings/errors