/akill cmd ?! - 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: /akill cmd ?! (
/showthread.php?tid=210690)
/akill cmd ?! -
Michael@Belgium - 13.01.2011
Yeah, so i've searched a lot to find an akill cmd but every code is with includes, ...
Maybe someone
give me the /akill cmd without a include, plugins, ...
Plz help me guys ! I thank you alot ^^
SOLVED
Re: /akill cmd ?! -
Finn - 13.01.2011
What does
/akill do?
Re: /akill cmd ?! -
Michael@Belgium - 13.01.2011
Quote:
Originally Posted by Finn
What does /akill do?
|
Admin kill
( and btw: i don't have a server with adminlevels, so no adminslevels too
)
Re: /akill cmd ?! -
blackwave - 13.01.2011
Just a basic one. Even though I recommend dcmd, or zcmd + sscanf (Easiest ever, these one I told)
pawn Код:
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128],idx,tmp[256];
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/akill", true))
{
new id;
tmp = strtok(cmdtext, idx);
id = strval(tmp);
if(strlen(tmp) == 0) return false;
else SetPlayerHealth(id, 0);
}
return 0;
}
Re: /akill cmd ?! -
Michael@Belgium - 15.01.2011
Quote:
Originally Posted by blackwave
Just a basic one. Even though I recommend dcmd, or zcmd + sscanf (Easiest ever, these one I told)
pawn Код:
stock strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; }
new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[128],idx,tmp[256]; cmd = strtok(cmdtext, idx); if(!strcmp(cmd, "/akill", true)) { new id; tmp = strtok(cmdtext, idx); id = strval(tmp); if(strlen(tmp) == 0) return false; else SetPlayerHealth(id, 0); } return 0; }
|
yes it works ty xD
Re: /akill cmd ?! -
DeadAhead - 15.01.2011
Umm one problem: Thats a very newbie and Wrong way of making commands. Get DCMD and SSCANF2, Belive me, their gonna make life easier on ya.
Re: /akill cmd ?! -
Michael@Belgium - 15.01.2011
Quote:
Originally Posted by DeadAhead
Umm one problem: Thats a very newbie and Wrong way of making commands. Get DCMD and SSCANF2, Belive me, their gonna make life easier on ya.
|
yeah , i know that ... but i dont need it
Re: /akill cmd ?! -
alpha500delta - 15.01.2011
ZCMD and SSCANF are much better
Really you should get it
Re: /akill cmd ?! -
DevilG - 15.01.2011
Quote:
Originally Posted by Michael@Belgium
yes it works ty xD
|
Uh.. You might want to edit it a little bit, because if you put that in your script, everyone can do /akill and kill other players!
Re: /akill cmd ?! -
Michael@Belgium - 15.01.2011
Quote:
Originally Posted by DevilG
Uh.. You might want to edit it a little bit, because if you put that in your script, everyone can do /akill and kill other players!
|
Yeah, i've edit that :
pawn Код:
new cmd[128],idx,tmp[256];
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/akill", true, 6))
{
if (IsPlayerAdmin(playerid))
{
new id;
tmp = strtok(cmdtext, idx);
id = strval(tmp);
if(strlen(tmp) == 0) return false;
else SetPlayerHealth(id, 0);
SendClientMessageToAll(COLOR_RED, "Someone is been killed by the admin !");
}
}