Admin Duty Command
#1

I need a /aduty command that goes like

Код:
CMD:kick(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 2)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] >= PlayerInfo[playerid][pAdmin] && (PlayerInfo[giveplayerid][pHelper] >= 2 || PlayerInfo[giveplayerid][pAdmin] > 0) && playerid != giveplayerid)
			{
				format(string, sizeof(string), "AdmCmd: %s has been auto-kicked, reason: Trying to /kick a higher admin.", GetPlayerNameEx(playerid));
				ABroadCast(COLOR_YELLOW,string, (PlayerInfo[playerid][pAdmin] == 1) ? (1) : (2));
				Kick(playerid);
				return 1;
			}
			else
			{
				new year, month,day;
				getdate(year, month, day);
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				format(string, sizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year);
				Log("logs/kick.log", string);
				if(PlayerInfo[playerid][pAdmin] == 1) Log("logs/moderator.log", string);
				format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
				Kick(giveplayerid);
			}
			return 1;
		}
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
	return 1;
}
But i want /aduty not /kick
Reply
#2

PHP код:
CMD:aduty(playerid,params[]){
    new 
string[128];
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_GRAY,"You're not an admin!");
    if(
PlayerInfo[playerid][pAdminDuty] == 0)
    {
        
format(string,sizeof(string),"%s has just went on Admin Duty",GetName(playerid));
        
SendClientMessageToAll(COLOR_GREEN,string);
        
SetPlayerHealth(playerid,500000);
        
SetPlayerColor(playerid,COLOR_CYAN);
        
PlayerInfo[playerid][pAdminDuty] = 1;
        
adminlabel[playerid] = Create3DTextLabel("Admin on duty\n Do Not Attack!"COLOR_RED30.040.050.040.00);
        
Attach3DTextLabelToPlayer(adminlabel[playerid], playerid0.00.00.7);
    }
    else
    if(
PlayerInfo[playerid][pAdminDuty] == 1)
    {
        
format(string,sizeof(string),"%s has just went off Admin Duty",GetName(playerid));
        
SendClientMessageToAll(COLOR_RED,string);
        
PlayerInfo[playerid][pAdminDuty] = 0;
        
ResetPlayerWeapons(playerid);
        
SetPlayerColor(playerid,COLOR_WHITE);
        
SetPlayerHealth(playerid,0);
        
ForceClassSelection(playerid);
        
Delete3DTextLabel(adminlabel[playerid]);
    }
    return 
1;
    } 
You'll also need this
PHP код:
stock GetName(playerid)
{
    new 
Name[MAX_PLAYER_NAME];
    if(
IsPlayerConnected(playerid))
    {
        
GetPlayerName(playeridNamesizeof(Name));
    }
    else
    {
        
Name "Disconnected/Nothing";
    }
    return 
Name;

Its from my gamemode, if it helped rep+?
Reply
#3

C:\Users\User\Desktop\SAMP Scripts\GG\gamemodes\GG.pwn(58729) : error 017: undefined symbol "pAdminDuty"
C:\Users\User\Desktop\SAMP Scripts\GG\gamemodes\GG.pwn(58735) : error 017: undefined symbol "pAdminDuty"
C:\Users\User\Desktop\SAMP Scripts\GG\gamemodes\GG.pwn(5873 : error 017: undefined symbol "pAdminDuty"
C:\Users\User\Desktop\SAMP Scripts\GG\gamemodes\GG.pwn(58742) : error 017: undefined symbol "pAdminDuty"
Reply
#4

Heh, that was just from my line, you can just delete those lines if you dont want them, those just check if the player is on admin duty ( for my gamemode ) so yeah.. just delete the lines that say if(PlayerInfo[playerid][pAdminDuty] == 0)
Reply
#5

Hey do you have teamspeak or something i can contact you on like MSN, Xfire or anything maybe we can trade and help eachother out a bit
Reply
#6

sampserver.clanvent.com:3740 is my teamspeak.
Reply
#7

*****
Reply
#8

First of all this isnt an error it is warning and gamemode works even if there is warnings
And to fix this warning,search for : aduty then delete it because there is no use for it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)