/Setwanted 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: /Setwanted HELP (
/showthread.php?tid=404360)
/Setwanted HELP -
mailu - 02.01.2013
Hai
Yesterday, I was trying to make a command (/Setwanted), I didn't get warnings nor errors but when I go in-game and try to use the command, It just says "Error, Usage /setwanted (PlayerName/ID) (WantedLevel)" but I typed it correctly, like this "/Setwanted 0 4" 0 is my ID and 4 is the wanted level I want to set but nothing happens, it keeps showing me the same message.
Please help me, I'm a newbie
pawn Код:
dcmd(setwanted,9,cmdtext);
pawn Код:
dcmd_setwanted(playerid,params[])
{
new string[128];
new ID;
new wantedl;
if(sscanf(params,"us[100]",ID,wantedl))
{
SendClientMessage(playerid,COLOR_NUB,"USAGE: /Setwanted (Player Name/ID) (WantedLevel)");
return 1;
}
if(!IsPlayerAdmin(playerid)||PlayerInfo[playerid][pAdmin]<5)
{
SendClientMessage(playerid,-1,"{FF0000}__**ERROR**__ {FFFFFF}You cannot use this command");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot set his wanted level.",ID);
SendClientMessage(playerid,COLOR_NUB,string);
return 1;
}
SetPlayerWantedLevel(ID,wantedl);
PlayerInfo[playerid][pWantedLevel] =wantedl;
return 1;
}
Re: /Setwanted HELP -
park4bmx - 02.01.2013
why a string ?
pawn Код:
if(sscanf(params,"us[100]",ID,wantedl))
Change it to a integer:
pawn Код:
if(sscanf(params,"ui",ID,wantedl))
Re: /Setwanted HELP -
mailu - 02.01.2013
Still bugged, but whats the different betwen Integer and string?
Re: /Setwanted HELP -
Basssiiie - 03.01.2013
A string is a piece of text like "bla bla" or "this is a small piece of text". An integer is a number, like 1 or 25 or 34561. Know the difference, because it's quite a crucial difference.
For your problem, I suggest changing the 9 here to a 6 or 7 (the character length of your command):
Код:
dcmd(setwanted,9,cmdtext);
If that doesn't work, try using something like ZCMD, as DCMD is quite outdated.
Re: /Setwanted HELP -
ViruZz - 03.01.2013
Код:
Код:
dcmd_setwanted(playerid,params[])
{
new string[128], id wantedl;
if(sscanf(params,"ui",ID,wantedl))
return SendClientMessage(playerid,COLOR_NUB,"USAGE: /Setwanted (Player Name/ID) (WantedLevel)");
if(!IsPlayerAdmin(playerid)||PlayerInfo[playerid][pAdmin]<5)
return SendClientMessage(playerid,-1,"{FF0000}__**ERROR**__ {FFFFFF}You cannot use this command");
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot set his wanted level.",ID);
SendClientMessage(playerid,COLOR_NUB,string);
}
SetPlayerWantedLevel(ID,wantedl);
PlayerInfo[playerid][pWantedLevel] =wantedl;
return 1;
}