Warn System
#1

hey guys,
Can you tell me how to make warn system?
Reply
#2

Create a command, send a message to the warned player, write it to a logfile.

That shouldn't be too hard..
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=392412
Reply
#4

i used it, not good
Reply
#5

If you mean warn like this.



PHP код:
CMD:warn(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /warn [playerid/partofname] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] >= 1)
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Admins can't be warned!");
                return 
1;
            }
            
PlayerInfo[giveplayerid][pWarns] += 1;
            if(
PlayerInfo[giveplayerid][pWarns] >= 3)
            {
                new 
ip[32];
                
GetPlayerIp(giveplayerid,ip,sizeof(ip));
                
format(stringsizeof(string), "AdmCmd: %s (IP: %s) was banned by %s (had 3 Warnings), reason: %s"GetPlayerNameEx(giveplayerid), ipGetPlayerNameEx(playerid), reason);
                
Log("logs/ban.log"string);
                
format(stringsizeof(string), "AdmCmd: %s was banned by %s (had 3 Warnings), reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
ABroadCast(COLOR_LIGHTREDstring5);
                
PlayerInfo[giveplayerid][pBanned] = 1;
                
AddBan(ip);
                
Kick(giveplayerid);
                return 
1;
            }
            
format(stringsizeof(string), "AdmCmd: %s was warned by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            
ABroadCast(COLOR_LIGHTREDstring1);
            
format(stringsizeof(string), "AdmCmd: %s was warned by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            
Log("logs/admin.log"string);
            
format(stringsizeof(string), "You were warned by %s, reason: %s"GetPlayerNameEx(playerid), reason);
            
SendClientMessage(giveplayeridCOLOR_LIGHTREDstring);
            return 
1;
        }
    }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    return 
1;

Reply
#6

I hope this will work

PHP код:
new warnings[MAX_PLAYERS];
#define MAX_WARNINGS 3 
PHP код:
OnPlayerConnect()
warnings[playerid] = 0
Somewhere
PHP код:
new wLevels
PHP код:
CMD:warn(playeridparams[])
{
    if(
PlayerInfo[playerid][AdminLevel] < 1) return 0;
    new 
string[128], targetplayerreason[75], pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
    if(
sscanf(params"us[75]"targetplayerreason)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /warn [ID] [Reason]");
    if(!
IsPlayerConnected(targetplayer)) return SendClientMessage(playeridCOLOR_RED"Error: Player is not connected");
    if(
strlen(reason) < 1) return SendClientMessage(playeridCOLOR_RED"Error: Invalid warning reason.");
    
warnings[targetplayer]++;
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
GetPlayerName(targetplayerpName2MAX_PLAYER_NAME);
    if(
warnings[targetplayer] < MAX_WARNINGS){ format(stringsizeof string"%s has been warned by %s for (%s)."pName2pNamereason); }
    else
    {
        
format(stringsizeof string"%s has been warned by %s for (%s). %s has been kicked for receiving %i/%i warnings."pName2pNamereasonpName2warnings[targetplayer], MAX_WARNINGS);
         
printf("[KICK] %s has been kicked for receiving max warnings."pName2);
        
SetTimerEx("DelayedKick"50false"i"targetplayer);
     }
     
SendClientMessageToAll(COLOR_TOMATOstring);
    return 
1;

It will kick the player automatically after 3 warnings
Reply
#7

Quote:
Originally Posted by XBrianX
Посмотреть сообщение
If you mean warn like this.



PHP код:
CMD:warn(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)
    {
        
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /warn [playerid/partofname] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
PlayerInfo[giveplayerid][pAdmin] >= 1)
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Admins can't be warned!");
                return 
1;
            }
            
PlayerInfo[giveplayerid][pWarns] += 1;
            if(
PlayerInfo[giveplayerid][pWarns] >= 3)
            {
                new 
ip[32];
                
GetPlayerIp(giveplayerid,ip,sizeof(ip));
                
format(stringsizeof(string), "AdmCmd: %s (IP: %s) was banned by %s (had 3 Warnings), reason: %s"GetPlayerNameEx(giveplayerid), ipGetPlayerNameEx(playerid), reason);
                
Log("logs/ban.log"string);
                
format(stringsizeof(string), "AdmCmd: %s was banned by %s (had 3 Warnings), reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
ABroadCast(COLOR_LIGHTREDstring5);
                
PlayerInfo[giveplayerid][pBanned] = 1;
                
AddBan(ip);
                
Kick(giveplayerid);
                return 
1;
            }
            
format(stringsizeof(string), "AdmCmd: %s was warned by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            
ABroadCast(COLOR_LIGHTREDstring1);
            
format(stringsizeof(string), "AdmCmd: %s was warned by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            
Log("logs/admin.log"string);
            
format(stringsizeof(string), "You were warned by %s, reason: %s"GetPlayerNameEx(playerid), reason);
            
SendClientMessage(giveplayeridCOLOR_LIGHTREDstring);
            return 
1;
        }
    }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You're not authorized to use that command!");
    return 
1;

Stop copying your scripts dude, he would never learn something.
For creating a warn system, just make a variable. If the variable equal 1, the player's getting the warn, if it's 0, he doesn't.
Reply
#8

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
Stop copying your scripts dude, he would never learn something.
For creating a warn system, just make a variable. If the variable equal 1, the player's getting the warn, if it's 0, he doesn't.
How do you suggest him to create a "warn system" without knowing anything , i made him a simple warn system that save the logs and does require admin level 1 , it's pretty much simple.
Reply
#9

I made him a easy warn system included a kick after 3 warnings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)