/kill help...
#1

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?
Reply
#2

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;
	}
Reply
#3

Quote:
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;
	}
Wow...

pawn Код:
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);
}
Reply
#4

https://sampwiki.blast.hk/wiki/Fast_Commands
Reply
#5

None of them work.
Reply
#6

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"
Reply
#7

Quote:
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"
Get dutils include.
Reply
#8

Make an include called returnuser.inc with this (make sure to Save As):
http://pyrokid.pastebin.com/f57277676

In this directory:
C:\Program Files\Rockstar Games\GTA San Andreas\samp\pawno\include

And add this to the top of your script:
pawn Код:
#include <returnuser>
Reply
#9

Ill try to get dutils, if not then ill try yours pyrokid.
Reply
#10

I put dutils in includes folder and I get this:
Oh and I also put #include<dutils>

C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 657 : error 047: array sizes do not match, or destination array is too small
C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 6579) : error 047: array sizes do not match, or destination array is too small
C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 7673) : error 021: symbol already defined: "strtok"
C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 768 : error 047: array sizes do not match, or destination array is too small
C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 8605) : error 017: undefined symbol "ReturnUser"
C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 9750) : warning 219: local variable "mod" shadows a variable at a preceding level
C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 19102) : error 047: array sizes do not match, or destination array is too small
C:\Users\Pivot\Desktop\Server\gamemodes\penls.pwn( 19371) : warning 203: symbol is never used: "ret_memcpy"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)