/warn problem
#1

Ive this /warn code, but when i warn someone its doesnt show the reason i gave...


Why?


Код:
  if(strcmp(cmd,"/warn",true)==0)
	{
   if(PlayerInfo[playerid][pAdmin] >= 2)
  	tmp = strtok(cmdtext, idx);
  	new otherplayer = ReturnUser(tmp);
  	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
 		if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn yourself !");
	  if(PlayerInfo[otherplayer][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn Admins!");
		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)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
		if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
		new year, month, day;
		getdate(year, month, day);
		PlayerInfo[otherplayer][pWarns] ++;
		format(string, sizeof(string), "%s was warned by Administrator %s, Reason: (%s)", giveplayer, sendername, PlayerInfo[playerid][pWarns], (result));
		SendClientMessageToAll(COLOR_RED, string);
		return 1;
	}
Reply
#2

(result) = result
Reply
#3

in here? :
if(!strlen(result))


To change it like this? :

if(!strlenresult)


?

Expline me please.
Reply
#4

Oh no my bad, I looked wrong at it. I just straigh went to what the format shows.
pawn Код:
format(string, sizeof(string), "%s was warned by Administrator %s, Reason: (%s)", giveplayer, sendername,result);
SendClientMessageToAll(COLOR_RED, string);
Reply
#5

Thanks alot man!!!


But my lines now, will not ban the user or something else if i warn him over X times?

Right?

Thanks bro
Reply
#6

try this one mate:

Код:
	if(strcmp(cmd, "/warn", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /warn [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			  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: /warn [playerid/PartOfName] [reason]");
							return 1;
						}
						PlayerInfo[giveplayerid][pWarns] += 1;
						if(PlayerInfo[giveplayerid][pWarns] >= 3)
						{
						  new year, month,day;
							getdate(year, month, day);
							format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
							BanLog(string);
							format(string, sizeof(string), "AdmCmd: %s was banned by %s (had 3 Warnings), reason: %s", giveplayer, sendername, (result));
							SendClientMessageToAll(COLOR_LIGHTRED, string);
							PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
							PlayerInfo[giveplayerid][pLevel] = -999;
							Ban(giveplayerid);
							return 1;
						}
						format(string, sizeof(string), "You warned %s, reason: %s", giveplayer, (result));
						SendClientMessage(playerid, COLOR_LIGHTRED, string);
						format(string, sizeof(string), "You were warned by %s, reason: %s", sendername, (result));
						SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), " %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply
#7

Yea I know this, From the GF GM.

Lol Thats what I didnt want.

Thanks all!
Reply
#8

Quote:
Originally Posted by Taz86
Yea I know this, From the GF GM.

Lol Thats what I didnt want.

Thanks all!
This one is works perfect. i use it in my gamemode.
Reply
#9

Quote:
Originally Posted by Jeff_Maxwell
Quote:
Originally Posted by Taz86
Yea I know this, From the GF GM.

Lol Thats what I didnt want.

Thanks all!
This one is works perfect. i use it in my gamemode.
But he doesn't want it..
I think you want that if player has X warns he gets autoban?
pawn Код:
if(!strcmp(cmd,"/warn",true))
{
  if(PlayerInfo[playerid][pAdmin]<2) return SendClientMessage(playerid,COLOR_GREY,"You are not authorized.");
  cmd=strtok(cmdtext, idx);
  new otherplayer = ReturnUser(cmd);
  if(!strlen(cmd)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
  if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn yourself !");
  if(PlayerInfo[otherplayer][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn Admins!");
  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)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
  if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
  PlayerInfo[otherplayer][pWarns] ++;
  if(PlayerInfo[otherplayer][pWarns]>5) // If he has more than 5 warnings.
  {
    format(string,sizeof(string),"AdmCmd: %s autobanned. (5 warnings",giveplayer);
    SendClientMessageToAll(COLOR_LIGHTRED,string);
    return Ban(id);
  }
  format(string, sizeof(string), "%s was warned by Administrator %s, Reason: (%s)", giveplayer, sendername, PlayerInfo[playerid][pWarns], (result));
  return SendClientMessageToAll(COLOR_RED, string);
}
Hope I helped
Reply
#10

Oh Fuck guys!!


When i warn someone.

Its says:

Taz86 Was bla bla bla by Admin Taz86

And i cant warn myself.

I did other ID.

What to do!?


Код:
  if(strcmp(cmd,"/warn",true)==0)
	{
   if(PlayerInfo[playerid][pAdmin] >= 2)
  	tmp = strtok(cmdtext, idx);
  	new otherplayer = ReturnUser(tmp);
  	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
 		if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn yourself !");
	  if(PlayerInfo[otherplayer][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn Admins!");
		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)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
		if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
		new year, month, day;
		getdate(year, month, day);
		PlayerInfo[otherplayer][pWarns] ++;
    format(string, sizeof(string), "%s was warned by Administrator %s, Reason: (%s)", giveplayer, sendername,result);
    SendClientMessageToAll(COLOR_RED, string);
		return 1;
	}
Reply
#11

Quote:
Originally Posted by MenaceX^
Quote:
Originally Posted by Jeff_Maxwell
Quote:
Originally Posted by Taz86
Yea I know this, From the GF GM.

Lol Thats what I didnt want.

Thanks all!
This one is works perfect. i use it in my gamemode.
But he doesn't want it..
I think you want that if player has X warns he gets autoban?
pawn Код:
if(!strcmp(cmd,"/warn",true))
{
  if(PlayerInfo[playerid][pAdmin]<2) return SendClientMessage(playerid,COLOR_GREY,"You are not authorized.");
  cmd=strtok(cmdtext, idx);
  new otherplayer = ReturnUser(cmd);
  if(!strlen(cmd)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
  if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn yourself !");
  if(PlayerInfo[otherplayer][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn Admins!");
  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)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
  if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
  PlayerInfo[otherplayer][pWarns] ++;
  if(PlayerInfo[otherplayer][pWarns]>5) // If he has more than 5 warnings.
  {
    format(string,sizeof(string),"AdmCmd: %s autobanned. (5 warnings",giveplayer);
    SendClientMessageToAll(COLOR_LIGHTRED,string);
    return Ban(id);
  }
  format(string, sizeof(string), "%s was warned by Administrator %s, Reason: (%s)", giveplayer, sendername, PlayerInfo[playerid][pWarns], (result));
  return SendClientMessageToAll(COLOR_RED, string);
}
Hope I helped
that is in my code that if they have 3 warnings the get banned.

Код:
if(PlayerInfo[giveplayerid][pWarns] >= 3)
						{
						  new year, month,day;
							getdate(year, month, day);
							format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
							BanLog(string);
							format(string, sizeof(string), "AdmCmd: %s was banned by %s (had 3 Warnings), reason: %s", giveplayer, sendername, (result));
							SendClientMessageToAll(COLOR_LIGHTRED, string);
							PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
							PlayerInfo[giveplayerid][pLevel] = -999;
							Ban(giveplayerid);
							return 1;
						}
Reply
#12

No no no what i gave before that what i want.


Cause i got RP server , and all do non rp, non rp driving so i got to warn them , so until X warns the get ban/kicked.
Not want it.

I want what i have.


well help me please.

i post it before.
Reply
#13

Help me guys... Please.
Reply
#14

Quote:
Originally Posted by Taz86
Help me guys... Please.
i don't understand what you want.
Reply
#15

Here mate.

Ive this /warn code, but when im warn someone else its shows me that i warned my self.


/warn 1 Test:


=

Taz86 was warned by admin taz86 reason: bla bla bla



Why?
I want it to show the name it was warned...

Код:
  if(strcmp(cmd,"/warn",true)==0)
	{
   if(PlayerInfo[playerid][pAdmin] >= 2)
  	tmp = strtok(cmdtext, idx);
  	new otherplayer = ReturnUser(tmp);
  	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
 		if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn yourself !");
	  if(PlayerInfo[otherplayer][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn Admins!");
		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)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
		if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
		new year, month, day;
		getdate(year, month, day);
		PlayerInfo[otherplayer][pWarns] ++;
    format(string, sizeof(string), "%s was warned by Administrator %s, Reason: (%s)", giveplayer, sendername,result);
    SendClientMessageToAll(COLOR_RED, string);
		return 1;
	}
Reply
#16

Change
pawn Код:
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
to
pawn Код:
GetPlayerName(otherplayer, giveplayer, sizeof(giveplayer));
Reply
#17

Thanks man!
Reply
#18

Quote:
Originally Posted by Jeff_Maxwell
try this one mate:

Код:
	if(strcmp(cmd, "/warn", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /warn [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			  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: /warn [playerid/PartOfName] [reason]");
							return 1;
						}
						PlayerInfo[giveplayerid][pWarns] += 1;
						if(PlayerInfo[giveplayerid][pWarns] >= 3)
						{
						  new year, month,day;
							getdate(year, month, day);
							format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
							BanLog(string);
							format(string, sizeof(string), "AdmCmd: %s was banned by %s (had 3 Warnings), reason: %s", giveplayer, sendername, (result));
							SendClientMessageToAll(COLOR_LIGHTRED, string);
							PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];
							PlayerInfo[giveplayerid][pLevel] = -999;
							Ban(giveplayerid);
							return 1;
						}
						format(string, sizeof(string), "You warned %s, reason: %s", giveplayer, (result));
						SendClientMessage(playerid, COLOR_LIGHTRED, string);
						format(string, sizeof(string), "You were warned by %s, reason: %s", sendername, (result));
						SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), " %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
When i place you cmd in my gm he say it :/ plz help me

C:\Documents and Settings\Propriйtaire\Bureau\SServeur samp\True Crime Street of LS test 63house\gamemodes\penlstest.pwn(1690 : warning 217: loose indentation
C:\Documents and Settings\Propriйtaire\Bureau\SServeur samp\True Crime Street of LS test 63house\gamemodes\penlstest.pwn(1691 : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\Propriйtaire\Bureau\SServeur samp\True Crime Street of LS test 63house\gamemodes\penlstest.pwn(16945) : error 017: undefined symbol "pWarns"
C:\Documents and Settings\Propriйtaire\Bureau\SServeur samp\True Crime Street of LS test 63house\gamemodes\penlstest.pwn(16946) : error 017: undefined symbol "pWarns"
C:\Documents and Settings\Propriйtaire\Bureau\SServeur samp\True Crime Street of LS test 63house\gamemodes\penlstest.pwn(16951) : error 017: undefined symbol "BanLog"
C:\Documents and Settings\Propriйtaire\Bureau\SServeur samp\True Crime Street of LS test 63house\gamemodes\penlstest.pwn(16976) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


7 Errors.
Reply
#19

up
Reply
#20

Quote:
Originally Posted by scott1
D:\SERVER\gamemodes\foxx.pwn(76 : error 017: undefined symbol "ReturnUser"
D:\SERVER\gamemodes\foxx.pwn(769) : error 017: undefined symbol "PlayerInfo"
D:\SERVER\gamemodes\foxx.pwn(769) : warning 215: expression has no effect
D:\SERVER\gamemodes\foxx.pwn(769) : error 001: expected token: ";", but found "]"
D:\SERVER\gamemodes\foxx.pwn(769) : error 029: invalid expression, assumed zero
D:\SERVER\gamemodes\foxx.pwn(769) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

not to put the command without bugs?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)