14.03.2009, 03:50
NOT THE /kill where you suicide, the /kill where an admin can kill another player.
I need some help with this...
Anyone have a code?
I need some help with this...
Anyone have a code?
if(strcmp(cmd, "/killplayer", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /killplayer [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /killplayer [playerid/PartOfName] [reason]"); return 1; } format(string, sizeof(string), "AdmCmd: %s was admin-killed by %s, reason: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); SetPlayerHealth(giveplayerid,0.0); } else { format(string, sizeof(string), " %d is not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; }
Originally Posted by Calgon
Depending on the script you're using, I can't figure out a way to determine the user is Admin if you don't have a base script.
Код:
if(strcmp(cmd, "/killplayer", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /killplayer [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /killplayer [playerid/PartOfName] [reason]"); return 1; } format(string, sizeof(string), "AdmCmd: %s was admin-killed by %s, reason: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); SetPlayerHealth(giveplayerid,0.0); } else { format(string, sizeof(string), " %d is not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } |
if(!strcmp(cmd,"/kill",true))
{
cmd=strtok(cmdtext,idx);
if(!strlen(cmd)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /kill [playerid/name]");
new id=RetrunUser(cmd);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_GREY,"Invalid playerid.");
return SetPlayerHealth(id,0);
}
Originally Posted by .:★Fr4zZ★:.
Wait im sorry, the one that does work is Menace's, but with one error:
C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 8604) : error 017: undefined symbol "ReturnUser" |
#include <returnuser>