wanted level cmds
#1

Код:
if (strcmp("heal", cmdtext, true, 10) == 0)
	{
        if(GetPlayerWantedLevel(playerid) == >1)
		{
            SetPlayerHealth(playerid, 100);
        }
        else
        {
            SendClientMessage(playerid, 0xFFAE1CFF, "Your wanted level has to be 1 to be able to use this cmd");
		}
	}
The problem is without this sign > it works fine but i want anyone with a greater wanted level than that to be able to use the cmd what can I do to correct this?
Reply
#2

Код:
if (strcmp("heal", cmdtext, true, 10) == 0)
	{
        if(GetPlayerWantedLevel(playerid) >= 1)
		{
            SetPlayerHealth(playerid, 100);
        }
        else
        {
            SendClientMessage(playerid, 0xFFAE1CFF, "Your wanted level has to be 1 to be able to use this cmd");
		}
	}
try this
Reply
#3

does not work at all now
Reply
#4

I stopped using strcmp for commands a while back but try this:

pawn Код:
if (strcmp("heal", cmdtext, true, 10) == 0)
{
    if(GetPlayerWantedLevel(playerid) == 1)
    {
        SetPlayerHealth(playerid, 100);
    }
    else
    {
        SendClientMessage(playerid, 0xFFAE1CFF, "Your wanted level has to be 1 to be able to use this cmd");
    }
And you said you want people with wanted levels higher than 1 to use it?

Код:
==	means equal to
>	means more than
<	means less than
>=	means more than or equal to
<=	means less than or equal to
Reply
#5

I tried that before i posted this topic with the new attempt.
That only allows the person with 1 stars to be able to do the commands but i want to be able to do it so any player with stars greater than 1 are able to use it.
Reply
#6

Then remove the '==' and put '>'
Like this:

pawn Код:
if (strcmp("heal", cmdtext, true, 10) == 0)
{
    if(GetPlayerWantedLevel(playerid) > 1)
    {
        SetPlayerHealth(playerid, 100);
    }
    else
    {
        SendClientMessage(playerid, 0xFFAE1CFF, "Your wanted level has to be more than 1 to be able to use this cmd");
    }
Reply
#7

Tried it doesnt work :/
Reply
#8

Ok tell me exactly what you want to do
Reply
#9

Well im making an admin system using the wanted stars.
So I need 1 cmd so I know how to do the rest.

Basically I am making a cmd /heal and only people that have 1 stars or above may only be able to use that cmd.
Anyone under that should receive a message saying

"Your wanted level has to be more than 1 to be able to use this cmd"
Reply
#10

Try this:
pawn Код:
if (strcmp("heal", cmdtext, true, 10) == 0)
{
    if(GetPlayerWantedLevel(playerid) < 1)return SendClientMessage(playerid, 0xFFAE1CFF, "Your wanted level has to be more than 1 to be able to use this cmd");
    SetPlayerHealth(playerid, 100);
    return 1;
}
I still don't know why the previous one did not work but try that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)