Warning/Kick system problems.
#1

Hello guys, i hate my Warning system and kick system is on PPC Trucking i thing much people know it, i want another one like Ladmin can anyone make me me? her are codes of Warn/Kick
Warn one:
Код:
// Warn a player
COMMAND:warn(playerid, params[])
{
	new PlayerToWarn, Reason[128], ReasonMsg[128], Name[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/warn", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 1
		if (APlayerData[playerid][PlayerLevel] >= 1)
		{
			if (sscanf(params, "us[128]", PlayerToWarn, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/warn <PlayerToWarn> <Reason>\"");
			else
				if (IsPlayerConnected(PlayerToWarn)) // If the player is a valid playerid (he's connected)
				{
					// Increase the number of warnings
					APlayerData[PlayerToWarn][Warnings]++;

					// Get the name of the player who warned the player
					GetPlayerName(playerid, Name, sizeof(Name));
					// Send the warned player a message who warned him and why he's been warned
					format(ReasonMsg, 128, "You have been warned by %s %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
					SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
					format(ReasonMsg, 128, "Reason: %s", Reason);
					SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
					format(ReasonMsg, 128, "~w~Warning %i/%i: ~r~%s~w~", APlayerData[PlayerToWarn][Warnings], AutoKickWarnings, Reason);
					GameTextForPlayer(PlayerToWarn, ReasonMsg, 5000, 4);

					// Get the name of the warned player
					GetPlayerName(PlayerToWarn, Name, sizeof(Name));
					// Let the admin know who has been warned and why
					format(ReasonMsg, 128, "You have warned %s (warnings: %i/%i)", Name, APlayerData[PlayerToWarn][Warnings], AutoKickWarnings);
					SendClientMessage(playerid, 0x00FF00FF, ReasonMsg);
					format(ReasonMsg, 128, "Reason: %s", Reason);
					SendClientMessage(playerid, 0xFF0000FF, ReasonMsg);

					// Automatically kick the player if he got 3 warnings (if autokick is enabled)
					if ((APlayerData[PlayerToWarn][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1))
						Kick(PlayerToWarn);
				}
				else
				    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
Kick:
Код:
// Kicks a player with a reason
COMMAND:kick(playerid, params[])
{
	new PlayerToKick, Reason[128], ReasonMsg[128], Name[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/kick", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 1
		if (APlayerData[playerid][PlayerLevel] >= 1)
		{
			if (sscanf(params, "us[128]", PlayerToKick, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kick <PlayerToKick> <Reason>\"");
			else
				if (IsPlayerConnected(PlayerToKick)) // If the player is a valid playerid (he's connected)
				{
					// Get the name of the player who warned the player
					GetPlayerName(playerid, Name, sizeof(Name));
					// Send the warned player a message who kicked him and why he's been kicked
					format(ReasonMsg, 128, "You have been kicked by %s %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
					SendClientMessage(PlayerToKick, 0xFF0000FF, ReasonMsg);
					format(ReasonMsg, 128, "Reason: %s", Reason);
					SendClientMessage(PlayerToKick, 0xFF0000FF, ReasonMsg);
					// Kick the player
					Kick(PlayerToKick);
				}
				else
				    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
I thing guys u know ladmin if u dont know it i will give codes of Ladmin warn/kick one guy try to help me bt get much errors. +1 REP for this who help me, Thanks much !
Reply
#2

Many people don't know what the LAdmin warn and kick function is, including me, could you explain? Like, what should it do?

PS: You need to set a timer for your Kicks and Bans or else the player who got kicked or banned won't see the message, that was an update in 0.3x.
Reply
#3

Umm could you post the LADMIN code I'll be glad to help you out.
Reply
#4

I just need to make them for i can use for my trucking server, bc one guy try to make bt get much errors and fail her are Ladmin warn/kick

Warn:
Код:
dcmd_warn(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 1) {
	    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /warn [playerid] [reason]");
    	new warned = strval(tmp), str[128];
		if(PlayerInfo[warned][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
	 	if(IsPlayerConnected(warned) && warned != INVALID_PLAYER_ID) {
 	    	if(warned != playerid) {
			    CMDMessageToAdmins(playerid,"WARN");
				PlayerInfo[warned][Warnings]++;
				if( PlayerInfo[warned][Warnings] == MAX_WARNINGS) {
					format(str, sizeof (str), "***Administrator \"%s\" has kicked \"%s\".  (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
					SendClientMessageToAll(grey, str);
					SaveToFile("KickLog",str);	Kick(warned);
					return PlayerInfo[warned][Warnings] = 0;
				} else {
					format(str, sizeof (str), "***Administrator \"%s\" has given \"%s\" a warning.  (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
					return SendClientMessageToAll(yellow, str);
				}
			} else return SendClientMessage(playerid, red, "ERROR: You cannot warn yourself");
		} else return SendClientMessage(playerid, red, "ERROR: Player is not connected");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Kick:
Код:
dcmd_kick(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
	    if(PlayerInfo[playerid][Level] >= 2) {
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /kick [playerid] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
				GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
				CMDMessageToAdmins(playerid,"KICK");
				if(!strlen(tmp2)) {
					format(string,sizeof(string),"%s has been kicked by Administrator %s [no reason given] ",playername,adminname); SendClientMessageToAll(grey,string);
					SaveToFile("KickLog",string); print(string); return Kick(player1);
				} else {
					format(string,sizeof(string),"%s has been kicked by Administrator %s [reason: %s] ",playername,adminname,params[2]); SendClientMessageToAll(grey,string);
					SaveToFile("KickLog",string); print(string); return Kick(player1); }
			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
		} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
Reply
#5

You want it in zcmd?
And BTW what will be the difference between yours and LADMINS?
I think your system is just fine.
Any ways tell me if you want it in dcmd or zcmd Ill post the code accordingly.
Reply
#6

Difference is, when u kick anyone in PPC trucking with his system other guys didnt see he is kicked, and when u warn anyone to no one see its warned and on Ladmin warn looks nicly and the kick
Reply
#7

Quote:
Originally Posted by kingofdemons
Посмотреть сообщение
You want it in zcmd?
And BTW what will be the difference between yours and LADMINS?
I think your system is just fine.
Any ways tell me if you want it in dcmd or zcmd Ill post the code accordingly.
i need it in COMMAND:
Reply
#8

Something like this?
pawn Код:
CMD:warn(playerid, params[])
{
    if(PlayerInfo[playerid][Level] >= 1)
    {
        new
            id,
            reason[32]
        ;
       
        if(sscanf(params, "us[32]", id, reason))
            return SendClientMessage(playerid, red, "USAGE: /warn [playerid/PartOfName] [reason]");
           
        if(PlayerInfo[id][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
            return SendClientMessage(playerid, red, "ERROR: You cannot use this command on this admin");
           
        if(IsPlayerConnected(id))
        {
            if(id == playerid)
                return SendClientMessage(playerid, red, "ERROR: You cannot warn yourself");
               
            CMDMessageToAdmins(playerid, "WARN");
            PlayerInfo[id][pWarnings]++;
           
            if(PlayerInfo[id][Warnings] == MAX_WARNINGS)
            {
                format(str, sizeof(str), "***Administrator \"%s\" has kicked \"%s\". (Reason: %s) (Warning: %d/%d)***",
                    pName(playerid), pName(id), reason, PlayerInfo[id][Warnings], MAX_WARNINGS);
                SendClientMessageToAll(grey, str);
                SaveToFile("KickLog", str);
                Kick(id);
                return PlayerInfo[id][Warnings] = 0;
            }
            else
            {
                format(str, sizeof (str), "***Administrator \"%s\" has given \"%s\" a warning.  (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(id), reason, PlayerInfo[id][Warnings], MAX_WARNINGS);
                return SendClientMessageToAll(yellow, str);
            }
        }
        else SendClientMessage(playerid, red, "ERROR: Player is not connected");
    }
    else SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
    return 1;
}
Reply
#9

yes, did it works? This one is CMD, i need COMMAND bt i will test

Код:
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\pawno\include\PPC_Dialogs.inc(503) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\pawno\include\PPC_Dialogs.inc(580) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\pawno\include\PPC_Dialogs.inc(646) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\pawno\include\PPC_Dialogs.inc(712) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\pawno\include\PPC_Dialogs.inc(744) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\gamemodes\PPC_Trucking.pwn(1489) : error 021: symbol already defined: "cmd_warn"
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\gamemodes\PPC_Trucking.pwn(1490) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\gamemodes\PPC_Trucking.pwn(1490) : warning 215: expression has no effect
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\gamemodes\PPC_Trucking.pwn(1490) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\gamemodes\PPC_Trucking.pwn(1490) : error 029: invalid expression, assumed zero
C:\Documents and Settings\dd\Desktop\truck server\PPC_Trucking\gamemodes\PPC_Trucking.pwn(1490) : fatal error 107: too many error messages on one line

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


5 Errors.
Reply
#10

Maybe will be easy to make direct FS bc i put it in GM bt if u make FS with it and dont give errors i thing it will works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)