/warn command for players ?
#1

Good morning people. It's possible to make one /warn command for players, and without kick/ban part if they reach 3 warnings? I need for players who don't see /me message warnings about poke/argue ( on a server ), so maybe /warn should work. Thank you and have a great day.

PS: I did search on forum, but since i'm new on scripting i don't really know what to edit on a defaut /warn command so all players ( admins too when they are not on duty ) to have acces.

If this topic it's wrong placed i'm so sorry,didn't find a proper section.
Reply
#2

Hello

Yes , it's possible to make that command , you need to make a variable and save/load it with y_ini (or other include like this) , before you make the command and there you will put something like that:

Код:
Variable[playerid] ++;
Reply
#3

Paste the default warn command you got as it containst the on duty variable and other player variables, and ill explain you what to remove
Reply
#4

Quote:

CMD:warn(playerid, params[])
{
if(pInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, FactColor[10], "You are not authorized to use that command !");

new id, reason[32], String[128];
if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, FactColor[11], "USAGE: /warn [PlayerID/PartOfName][Reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, FactColor[11], "That player it's not connected !");

format(String, sizeof(String), "Adm Cmd: %s was kicked by %s, reason: %s - warn", Name(id), Name(playerid), reason);
SendClientMessageToAll(0xA52A2AFF, String);

pInfo[id][pWarnings] ++;

if(pInfo[id][pWarnings] >= 3)
{
Ban(playerid);
return 1;
}
else SetTimerEx("KickPlayer", 300, false, "i", id);

return 1;
}

Got it from Mariciuc Thank you and waitinng your asnwer
Reply
#5

Quote:
Originally Posted by UnforgiveNNN
Посмотреть сообщение
Got it from Mariciuc Thank you and waitinng your asnwer
There the player will be kicked + when player have 3 warns the player will got banned ... i think you know how to edit
Reply
#6

Change the message in format
from
Код:
format(String, sizeof(String), "Adm Cmd: %s was kicked by %s, reason: %s - warn", Name(id), Name(playerid), reason);
to

Код:
format(String, sizeof(String), "Adm Cmd: %s was warned by %s, reason: %s", Name(id), Name(playerid), reason);
And remove the kick - ban part / warn variable

Код:
pInfo[id][pWarnings] ++;

if(pInfo[id][pWarnings] >= 3)
{
Ban(playerid);
return 1;
}
else SetTimerEx("KickPlayer", 300, false, "i", id);
Reply
#7

Quote:
Originally Posted by Battlezone
Посмотреть сообщение
Change the message in format
from
Код:
format(String, sizeof(String), "Adm Cmd: %s was kicked by %s, reason: %s - warn", Name(id), Name(playerid), reason);
to

format(String, sizeof(String), "Adm Cmd: %s was warned by %s, reason: %s", Name(id), Name(playerid), reason);[/code]

And remove the kick - ban part / warn variable

[code]pInfo[id][pWarnings] ++;

if(pInfo[id][pWarnings] >= 3)
{
Ban(playerid);
return 1;
}
else SetTimerEx("KickPlayer", 300, false, "i", id);
And how to made it all players will use it. not just an admin




Код:
CMD:warn(playerid, params[])
{
    if(pInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, FactColor[10], "You are not authorized to use that command !");

	new id, reason[32], String[128];
	if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, FactColor[11], "USAGE: /warn [PlayerID/PartOfName][Reason]");
	if(!IsPlayerConnected(id)) return SendClientMessage(playerid, FactColor[11], "That player it's not connected !");

	format(String, sizeof(String), "Adm Cmd: %s was warned by %s, reason: %s", Name(id), Name(playerid), reason);
	SendClientMessageToAll(0xA52A2AFF, String);


	return 1;
}
That's what i got by removing what you say
Reply
#8

If you want all players to use that cmd, you have to remove the admin check part too

Код:
 if(pInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, FactColor[10], "You are not authorized to use that command !");
Reply
#9

I did it before but i was not sure so i did ctrl+z Thank you mate.

One more thing,how to do the thing so only player who warn and warned player will see message.

I have to delete the :

Quote:

format(String, sizeof(String), "Adm Cmd: %s was warned by %s, reason: %s"

into
Quote:

format(string, sizeoff(string),"Player Cmd: %s was warned by %s,reason: %s

Reply
#10

Quote:
Originally Posted by UnforgiveNNN
Посмотреть сообщение
Got it from Mariciuc Thank you and waitinng your asnwer
Quote:
Originally Posted by UnforgiveNNN
Посмотреть сообщение
And how to made it all players will use it. not just an admin




Код:
CMD:warn(playerid, params[])
{
    if(pInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, FactColor[10], "You are not authorized to use that command !");

	new id, reason[32], String[128];
	if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, FactColor[11], "USAGE: /warn [PlayerID/PartOfName][Reason]");
	if(!IsPlayerConnected(id)) return SendClientMessage(playerid, FactColor[11], "That player it's not connected !");

	format(String, sizeof(String), "Adm Cmd: %s was warned by %s, reason: %s", Name(id), Name(playerid), reason);
	SendClientMessageToAll(0xA52A2AFF, String);


	return 1;
}
That's what i got by removing what you say
Sorry to ask such a silly question, but if this is your own code, how come you need to ask others what to remove?

Just curious as to how it is so hard to remove such simple code, especially when YOU claim it is your own code.

There are also ways to make the code a lot more neater, at the moment it is just a blob of messiness, just trying to help/suggest things for future coding.

Thanks,
CM707
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)