SA-MP Forums Archive
Cmd Modification. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cmd Modification. (/showthread.php?tid=625392)



Cmd Modification. - aymane123 - 01.01.2017

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;
}



Re: Cmd Modification. - iLearner - 01.01.2017

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.


Re: Cmd Modification. - aymane123 - 01.01.2017

but should i keep the "else".


Re: Cmd Modification. - iLearner - 01.01.2017

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


Re: Cmd Modification. - aymane123 - 01.01.2017

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);
            }