dcmd_kick(playerid, params[])
{
new
id,
reason[100];
if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /kick <playerid/partname> <reason (optional)>");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
SetPlayerHealth(playerid, 0.0);
format(reason, sizeof (reason), "You have been killed%s%s.", reason[0] ? (" for: ") : (""), reason);
SendClientMessage(id, 0xFF0000AA, reason);
SendClientMessage(playerid, 0x00FF00AA, "Player Killed");
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new tmp[128];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/kill", true) == 0)
{
if(!IsPlayerAdmin(playerid))
{
SetPlayerHealth(playerid,0);
}
if(IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SetPlayerHealth(playerid,0);
} else {
new id = strval(tmp);
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, RED, "Invalid player ID");
}
if(id != playerid)
{
if(IsPlayerAdmin(id))
{
SendClientMessage(playerid, RED, "You cannot /kill admins");
} else {
SetPlayerHealth(id,0);
}
}
}
}
return 1;
}
}
if(!strcmp(cmdtext,"/website",true))
{
SendClientMessage(playerid,0xFFFFFFFF,"Our topic in on Sa Mp forum.sa-mp.com/index.php?topic=102824.0");
return 1;
}
|
Originally Posted by Sal_Kings
How in the world do u make a command like
/kill id and the actions happen to them..Not YOU..I only know how to make stuff that happen to me Please give me a example of how i can type /kill id and it kills them.. |
C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(136) : error 017: undefined symbol "strtok" C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(136) : error 033: array must be indexed (variable "cmd") C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(135) : warning 203: symbol is never used: "idx" C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(134) : warning 204: symbol is assigned a value that is never used: "tmp" C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(783) : error 029: invalid expression, assumed zero C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(783) : error 029: invalid expression, assumed zero C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(784) : warning 217: loose indentation C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(790) : error 017: undefined symbol "strtok" C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(790) : error 033: array must be indexed (variable "cmd") C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(803) : error 017: undefined symbol "strtok" C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(803) : error 033: array must be indexed (variable "tmp") C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(814) : error 017: undefined symbol "RED" C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(822) : error 017: undefined symbol "RED" C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(830) : warning 217: loose indentation C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(788) : warning 203: symbol is never used: "idx" C:\Documents and Settings\Salim\Desktop\SalsTestinGrounds\SalsTestingGrounds.pwn(788 -- 836) : warning 217: loose indentation Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 10 Errors.
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;
}