SA-MP Forums Archive
wanted level cmds - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: wanted level cmds (/showthread.php?tid=274987)



wanted level cmds - muhib777 - 07.08.2011

Код:
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?


Re: wanted level cmds - dud - 07.08.2011

Код:
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


Re: wanted level cmds - muhib777 - 07.08.2011

does not work at all now


Re: wanted level cmds - Tee - 07.08.2011

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



Re: wanted level cmds - muhib777 - 07.08.2011

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.


Re: wanted level cmds - Tee - 07.08.2011

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



Re: wanted level cmds - muhib777 - 07.08.2011

Tried it doesnt work :/


Re: wanted level cmds - Tee - 07.08.2011

Ok tell me exactly what you want to do


Re: wanted level cmds - muhib777 - 07.08.2011

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"


Re: wanted level cmds - Tee - 08.08.2011

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.