Have problem with using SetPlayerWantedLevel(targetid,amount); - 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: Have problem with using SetPlayerWantedLevel(targetid,amount); (
/showthread.php?tid=89671)
Have problem with using SetPlayerWantedLevel(targetid,amount); -
woaha - 03.08.2009
When i try use command with playerID and AMOUNT OF STARS "/wanted 1 6", it says "Server: Unknown command".. but without amount of stars or player ID it says that error "You forget amount of starts or playerID.......".
There is something wich i forgot?
Код:
public OnPlayerCommandText(playerid,cmdtext[]) {
new cmd[256];
new idx;
cmd = strtok(cmdtext,idx);
new tmp[256];
// WANTED
if (strcmp(cmdtext, "/wanted", true) == 0)
{
tmp = strtok(cmdtext,idx);
new targetid = strval(tmp); // Target ID
new amount = strval(tmp); // How many stars
if(!strlen(tmp)) {
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You forget amount of stars or playerID -> /wanted [ID] [amount 1-6]");
return 1;
}
if(PlayerInfo[playerid][logged] == 0) {
SendClientMessage(playerid,COLOR_BRIGHTRED,"You must be logged in!");
return 1;
}
if (PlayerInfo[playerid][admin] < 2) {
SendClientMessage(playerid,COLOR_BRIGHTRED,"You have no rights to use this command... Or your security clearance are too low.");
return 1;
}
if(PlayerInfo[targetid][logged] == 0) {
SendClientMessage(playerid,COLOR_BRIGHTRED,"Player not found!");
return 1;
}
SetPlayerWantedLevel(targetid,amount); // The main function
return 1;
}
return 0;
}
Re: Have problem with using SetPlayerWantedLevel(targetid,amount); -
Jefff - 03.08.2009
Код:
public OnPlayerCommandText(playerid,cmdtext[]) {
new cmd[256];
new idx;
cmd = strtok(cmdtext,idx);
new tmp[256];
// WANTED
if (strcmp(cmd, "/wanted", true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) {
SendClientMessage(playerid,COLOR_LIGHTBLUE,"You forget amount of stars or playerID -> /wanted [ID] [amount 1-6]");
return 1;
}
new targetid = strval(tmp); // Target ID
tmp = strtok(cmdtext,idx);
new amount = strval(tmp); // How many stars
if(PlayerInfo[playerid][logged] == 0) {
SendClientMessage(playerid,COLOR_BRIGHTRED,"You must be logged in!");
return 1;
}
if (PlayerInfo[playerid][admin] < 2) {
SendClientMessage(playerid,COLOR_BRIGHTRED,"You have no rights to use this command... Or your security clearance are too low.");
return 1;
}
if(PlayerInfo[targetid][logged] == 0) {
SendClientMessage(playerid,COLOR_BRIGHTRED,"Player not found!");
return 1;
}
SetPlayerWantedLevel(targetid,amount); // The main function
return 1;
}
return 0;
}