CMD help.
#1

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

Reply
#2

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

What is the player id ?
Reply
#4

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

HELP!
Reply
#6

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

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

Reply
#8

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.
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)