Help with this command
#1

The other day i was playing on my server with the ladmin script and giving randoms admin so they would stay, and then somone banned me so now im trying to make all admin commands so there not possible to use on the owner, i made a PlayerInfo[playerid][Owner] thingy and set it to a file, but I cant get it to work on my /mute command heres the code

Код:
if(strcmp(cmd,"/mute",true) == 0)
{
	new tmp[256];
	new id;
	tmp = strtok(cmdtext,idx);
	id = strval(tmp);
	if (Logged[playerid] == 1)
	{
	 	if(!strlen(tmp))
	  	{
	  	   	SendClientMessage(playerid,ORANGE,"USAGE: /mute ID");
			return 1;
		}
		    if(PlayerInfo[id][Owner] == 0)
		    {
			    if(PlayerInfo[playerid][Level] > 2)
			    {
			        if(!IsPlayerConnected(id))
			        {
			            SendClientMessage(playerid,YELLOW,"Invalid ID");
					}

					else
					{
						new string[128];
						new name[MAX_PLAYER_NAME];
						GetPlayerName(playerid,name,sizeof(name));
						new nname[MAX_PLAYER_NAME];
						GetPlayerName(id,nname,sizeof(nname));
						format(string,sizeof(string)," * You have muted %s *",nname);
						SendClientMessage(playerid,YELLOW,string);
						format(string,sizeof(string)," * you have been muted by %s for 10 Minutes!",name);
						SendClientMessage(id,BRIGHTRED,string);
						SetTimerEx("MuteTimer", 600000, false, "i", id);
						PlayerInfo[id][Muted] = 1;
						return 1;
					}

				}
				else
				{
				    SendClientMessage(playerid,ORANGE,"You Have to be Level 3 to use this command");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid,GREY,"You cannot use this command on the owner!");
			    return 1;
			}
	}
	else
	{
	    SendClientMessage(playerid,ORANGE,"You have to be logged in to use this command!");
		return 1;
	}
	return 1;
}
also if its possible, would I be able to just put something before all the commands that says something like if hes the owner no commands will work on him, so i dont have to add them to every command
Reply
#2

Hmm for the admin thing it'll be

if you have a enum, with your info in it just add this
Код:
owner
But for me it would be pOwner due to myself having enum pOwner.

Is the commands in the filterscript or in the gamemode itself?
Reply
#3

i have it under enum and yes its a filterscript with that code, if i type /mute it will say USAGE: /mute id
which it is suppose to,
but if i type /mute 10 where 10 is an invalid player it will return the message, you have to be level 3 to use this command, and i have already set my file to level 5, if i type my own id it will return "You cannot use this command on the owner!",so the owner thing works, but im not 100% sure because nobody ever comes into my server so its always just me


all the other admin commands work btw, its just this one which i tried to add the owner thing to
Reply
#4

What about making it so the command won't work if player's admin level is lower than the person he's applying it on.
Reply
#5

that could work but im trying to get my own "owner" thing, so i can make a bunch of commands that only the owner can use

i would really apreciate it if somebody could help me put something under onplayercommandtext that would take effect to every command
i was thinking something along the lines of
Код:
if(PlayerInfo[otherplayer][Owner] = 1) return 0;
but that wouldnt work... anyone?

EDIT: Nevermind i figured it out, it was the order of the statements i had in it i changed it around a bit, i doubt this will help anyone but anyway heres my code that worked

Код:
if(strcmp(cmd,"/mute",true) == 0)
{
	new tmp[256];
	new id;
	tmp = strtok(cmdtext,idx);
	id = strval(tmp);
	if (Logged[playerid] == 1)
	{
	  	if(PlayerInfo[playerid][Level] > 2)
		{
	 		if(!strlen(tmp))
	  		{
	  	   		SendClientMessage(playerid,ORANGE,"USAGE: /mute ID");
				return 1;
			}
		   	 if(PlayerInfo[id][Owner] == 0)
  			{
			  
			        if(!IsPlayerConnected(id))
			        {
			            SendClientMessage(playerid,YELLOW,"Invalid ID");
					}

					else
					{
						new string[128];
						new name[MAX_PLAYER_NAME];
						GetPlayerName(playerid,name,sizeof(name));
						new nname[MAX_PLAYER_NAME];
						GetPlayerName(id,nname,sizeof(nname));
						format(string,sizeof(string)," * You have muted %s *",nname);
						SendClientMessage(playerid,YELLOW,string);
						format(string,sizeof(string)," * you have been muted by %s for 10 Minutes!",name);
						SendClientMessage(id,BRIGHTRED,string);
						SetTimerEx("MuteTimer", 600000, false, "i", id);
						PlayerInfo[id][Muted] = 1;
						return 1;
					}

			}
			else
			{
			    SendClientMessage(playerid,GREY,"You cannot use this command on the owner!");
			    return 1;
			}
 		}
		else
		{
		    SendClientMessage(playerid,ORANGE,"You Have to be Level 3 to use this command");
		    return 1;
		}
	}
	else
	{
	    SendClientMessage(playerid,ORANGE,"You have to be logged in to use this command!");
		return 1;
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)