Cmd Modification.
#1

So i am using a script (not mine) that means i didnt code it and i want change something like i cant use the cmd just if i am in aod and i cant use it on myself how to remove it ?
Код:
COMMAND:giveweapon(playerid, params[])
{
	if(!adminLevel(playerid, 3))
		return 0;
		
	new otherID, msg[128], weaponid;
	if(sscanf(params, "ud", otherID, weaponid))
	{
		Usage(playerid, "giveweapon <playerid> <weaponid>");
	}
	else
	{
		if(!Player[playerid][onDuty])	
		{
			Server(playerid, "You must be on duty admin.");
			return 1;
		}
		if(isMe(playerid, otherID))
		{
			Server(playerid, "You can't use this command to yourself.");
		}
		else
		{			
			if(!isConnected(otherID))
			{
				Server(playerid, "That player isn't logged in!");
				return 1;
			}
			
			if(isHigher(playerid, otherID))
				Server(playerid, "You can't use this command to that player.");
			else
			{
				format(msg, sizeof(msg), "give %s a weapon(%d).", GetName(otherID), weaponid);
				changeAlog(playerid, msg);
				GivePlayerWeapon(otherID, weaponid, 9999999);
				format(msg, sizeof(msg), "Administrator give you a weapon.");
				Server(otherID, msg);
				format(msg, sizeof(msg), "You have given "CHAT_YELLOW"%s(%d)"CHAT_WHITE" weapon(%d).", GetName(otherID), otherID, weaponid);
				Server(playerid, msg);
			}
		}
	}
	return 1;
}
Reply
#2

Quote:

if(!Player[playerid][onDuty])
{
Server(playerid, "You must be on duty admin.");
return 1;
}
if(isMe(playerid, otherID))
{
Server(playerid, "You can't use this command to yourself.");
}

That part means, you cant use it unless you are aod, and cannot use on yourself.
Reply
#3

but should i keep the "else".
Reply
#4

the else means, if the both conditions above weren't true, than do this
Reply
#5

so i have to keed it for those ?
PHP код:
            if(!isConnected(otherID))
            {
                
Server(playerid"That player isn't logged in!");
                return 
1;
            }
            
            if(
isHigher(playeridotherID))
                
Server(playerid"You can't use this command to that player.");
            else
            {
                
format(msgsizeof(msg), "give %s a weapon(%d)."GetName(otherID), weaponid);
                
changeAlog(playeridmsg);
                
GivePlayerWeapon(otherIDweaponid9999999);
                
format(msgsizeof(msg), "Administrator give you a weapon.");
                
Server(otherIDmsg);
                
format(msgsizeof(msg), "You have given "CHAT_YELLOW"%s(%d)"CHAT_WHITE" weapon(%d)."GetName(otherID), otherIDweaponid);
                
Server(playeridmsg);
            } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)