Help ! (+REP)
#5

PHP код:
COMMAND:warn(playeridparams[]) 

    new 
PlayerToWarnReason[128], ReasonMsg[128], Name[24], Target[24];
    
// Get the name 
    
GetPlayerName(playeridNamesizeof(Name));
    
GetPlayerName(PlayerToWarnTargetsizeof(Target));     
    
// 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]"PlayerToWarnReason)) SendClientMessage(playerid0xFF0000AA"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]++; 
                    
// Send the warned player a message who warned him and why he's been warned 
                    
format(ReasonMsg128"You have been warned by %s %s"AdminLevelName[APlayerData[playerid][PlayerLevel]], Name); 
                    
SendClientMessage(PlayerToWarn0xFF0000FFReasonMsg); 
                    
                    
format(ReasonMsg128"Reason: %s"Reason); 
                    
SendClientMessage(PlayerToWarn0xFF0000FFReasonMsg); 
                    
                    
format(ReasonMsg128"~w~Warning %i/%i: ~r~%s~w~"APlayerData[PlayerToWarn][Warnings], AutoKickWarningsReason); 
                    
GameTextForPlayer(PlayerToWarnReasonMsg50004); 
                    
// Let the admin know who has been warned and why 
                    
format(ReasonMsg128"You have warned %s (warnings: %i/%i)"TargetAPlayerData[PlayerToWarn][Warnings], AutoKickWarnings); 
                    
SendClientMessage(playerid0x00FF00FFReasonMsg); 
                    
                    
format(ReasonMsg128"Reason: %s"Reason); 
                    
SendClientMessage(playerid0xFF0000FFReasonMsg);
                    
                    
// Send it to all players
                    
format(ReasonMsgsizeof(ReasonMsg), "%s %s has warned %s. [Reason: %s]."AdminLevelName[APlayerData[playerid][PlayerLevel]], NameTargetReason);
                    
SendClientMessageToAll(0xFF0000FFReasonMsg);
                    
// Automatically kick the player if he got 3 warnings (if autokick is enabled) 
                    
if ((APlayerData[PlayerToWarn][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1)) 
                        
Kick(PlayerToWarn); 
                } 
                else 
                    
SendClientMessage(playerid0xFF0000FF"That player isn't online"); 
        } 
        else 
            return 
0
    } 
    else 
        return 
0
Edited it a little.

Should send a message to everybody saying [xx] Cody has warned Cody. Reason: Giggity.
Reply


Messages In This Thread
Help ! (+REP) - by bugmenotlol - 21.03.2016, 04:28
Re: Help ! (+REP) - by itsCody - 21.03.2016, 04:48
Re: Help ! (+REP) - by bugmenotlol - 21.03.2016, 05:41
Re: Help ! (+REP) - by bugmenotlol - 21.03.2016, 05:59
Re: Help ! (+REP) - by itsCody - 21.03.2016, 06:06
Re: Help ! (+REP) - by alexkeward - 21.03.2016, 06:06
Re: Help ! (+REP) - by itsCody - 21.03.2016, 06:21
Re: Help ! (+REP) - by alexkeward - 21.03.2016, 06:25
Re: Help ! (+REP) - by xTURBOx - 21.03.2016, 06:35
Re: Help ! (+REP) - by bugmenotlol - 21.03.2016, 09:04

Forum Jump:


Users browsing this thread: 3 Guest(s)