/wanted
#1

Hey guys, I'm trying to make a /wanted [playerid] [wantedlevel] command. but it is still kinda hard for me. I know that I am asking alot of you guys. But I really need an example and a little explanation of how to do it.

I'm thanking you in advance.

BTW:
I know I have to work with these things:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))

ButI don't know how to use them and what they actually do.XD

Now having this:
Код:
 if(strcmp(cmd,"/wanted", true) == 0)
	{

  	new name [MAX_PLAYER_NAME];
   	tmp = strtok(cmdtext, idx);
   	if(!strlen(tmp))
   	return SendClientMessage(playerid, 0xE3E3E3FF, "USAGE: /wanted [playerid]");
   	giveplayerid = strval(tmp);
   	if(IsPlayerConnected(giveplayerid))
   	if(sapd[giveplayerid] >= 1) {
	{
	if(sapd[playerid] >= 1) {

	SetPlayerWantedLevel(giveplayerid,1);

	}
	else
	{
	SendClientMessage(playerid,0xE3E3E3FF,"Je mag dit niet doen");
	}
	}
}

   return 1;
}
Reply
#2

you want the command is used only by sapd?
Reply
#3

yeaaaaaaa
Reply
#4

TRY USE A DCMD
put
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

to defines udner include asamp

under onplayertext put

dcmd(wanted,6,cmdtext);





and at end put



dcmd_wanted(playerid, params[])
{
if(sapd[playerid] >= 1)
{
new id,wanted,string[128];
if(sscanf(params, "ud", id,wanted)) return SendClientMessage(playerid, RED, "USAGE: /WANTED [ID / NICK] [1/6]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, RED, "This player is offline");
if(wanted < 0 || wanted > 6) return SendClientMessage(playerid,RED,"Error: Enter a valid wanted level: 1/6");
format(string,sizeof(string),"%s has Set %s his Wanted Level to: %d!",playerid,id,wanted);
SendClientMessageToAll(YELLOW,string);
SetPlayerWantedLevel(id,wanted);
}
else if(sapd[playerid] >= 0)
{
SendClientMessage(playerid,YELLOW,"you cant use this command you are not sapd");
}
return 1;
}


not tested
Reply
#5

This should work

pawn Код:
if(strcmp(cmd,"/wanted", true) == 0)
{
    //getting the id into 'tmp'
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, 0xE3E3E3FF, "USAGE: /wanted [playerid] [wantedlevel]");
    giveplayerid = strval(tmp);
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,0xE3E3E3FF,"Player not connected");
   
    //getting the name into 'tmp'
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, 0xE3E3E3FF, "USAGE: /wanted [playerid] [wantedlevel]");
    new wantedlvl = strval(tmp);
    if (wantedlvl < 0 || wantedlvl > 6) return SendClientMessage(playerid, 0xE3E3E3FF, "Valid wanted levels: 1 - 6");
   
    if(sapd[giveplayerid] >= 1)
    {
        if(sapd[playerid] >= 1)
        {
            SetPlayerWantedLevel(giveplayerid, wantedlvl);
        }
        else
        {
            SendClientMessage(playerid,0xE3E3E3FF,"Je mag dit niet doen");
        }
    }
    return 1;
}
Reply
#6

Thanks for helping but it always sets your wanted lvl to 0. Even when I do /wanted 0 5
Reply
#7

my or dice7 command?
Reply
#8

Both really thanks. gigi for trying to help me. Dice for fix it.

Thaaaaaaaankyaaaa
Reply
#9

maybe because u cant set other peoples wanted levels its only ure own
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)