/checkinventory
#1

Hello SA-MP i want to create a CMD that only admins 2-6 can do it it's /checkinventory

This is the code of my /frisk

Код:
CMD:checkinventory(playerid, params[]) {
	new string[128], giveplayerid;

	if(sscanf(params, "u", giveplayerid))
		return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /frisk [playerid/partofname]");

 	if(giveplayerid == INVALID_PLAYER_ID)
	 	return SendClientMessage(playerid, COLOR_GREY, "You can't frisk this player as they're not connected.");

	if(ProxDetectorS(8.0, playerid, giveplayerid)) {
		if(giveplayerid == playerid)
			return SendClientMessage(playerid, COLOR_GREY, "You can't frisk yourself!");

		if(giveplayerid == INVALID_PLAYER_ID)
		    return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");

		if(IsACop(playerid) || PlayerInfo[playerid][pJob] == 8 || PlayerInfo[playerid][pJob2] == 8 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pDivision] == 2) || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 5)) {
			SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
			format(string, sizeof(string), "*** %s' items...  ***", GetPlayerNameEx(giveplayerid));
			SendClientMessage(playerid, COLOR_WHITE, string);

			if(PlayerInfo[giveplayerid][pWSeeds] == 1)
				SendClientMessage(playerid, COLOR_GREY, "Marijuana Seeds");

			if(PlayerInfo[giveplayerid][pPhoneBook] > 0)
				SendClientMessage(playerid, COLOR_GREY, "Phone book.");

			if(PlayerInfo[giveplayerid][pCDPlayer] > 0)
				SendClientMessage(playerid, COLOR_GREY, "CD player.");

			if(PlayerInfo[giveplayerid][pRadio] > 0) {
				format(string, sizeof(string), "Portable radio (frequency #%d kHz)", PlayerInfo[giveplayerid][pRadioFreq]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}

			if(PlayerInfo[giveplayerid][pCarLic] > 0)
				SendClientMessage(playerid, COLOR_GREY, "Driver's license.");

			if(PlayerInfo[giveplayerid][pBoatLic] > 0)
				SendClientMessage(playerid, COLOR_GREY, "Boat driver's license.");

			if(PlayerInfo[giveplayerid][pFlyLic] > 0)
				SendClientMessage(playerid, COLOR_GREY, "Pilot's license.");

			if(PlayerInfo[giveplayerid][pCrack] > 0) {
				format(string, sizeof(string), "%d grams of crack.", PlayerInfo[giveplayerid][pCrack]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}
			if(PlayerInfo[giveplayerid][pPot] > 0) {
				format(string, sizeof(string), "%d grams of pot.", PlayerInfo[giveplayerid][pPot]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}
			if(PlayerInfo[giveplayerid][pMats] > 0) {
				format(string, sizeof(string), "%d materials.", PlayerInfo[giveplayerid][pMats]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}
			if(Fishes[giveplayerid][pWeight1] > 0 || Fishes[giveplayerid][pWeight2] > 0 || Fishes[giveplayerid][pWeight3] > 0 || Fishes[giveplayerid][pWeight4] > 0 || Fishes[giveplayerid][pWeight5] > 0) {
				format(string, sizeof(string), "%d fish.", PlayerInfo[giveplayerid][pFishes]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}

			new weaponname[50];
			format(string, sizeof(string), "*** %s' weapons...  ***", GetPlayerNameEx(giveplayerid));
			SendClientMessage(playerid, COLOR_WHITE, string);

			for(new i = 0; i < 12; i++) {
				if(PlayerInfo[giveplayerid][pGuns][i] > 0) {
					GetWeaponName(PlayerInfo[giveplayerid][pGuns][i], weaponname, sizeof(weaponname));
					format(string, sizeof(string), "Weapon: %s.", weaponname);
					SendClientMessage(playerid, COLOR_GRAD1, string);
				}
			}

			SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
			format(string, sizeof(string), "* %s has frisked %s.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		} else {
		    SetPVarInt(giveplayerid, "FriskREQ", playerid);

		    format(string, sizeof(string), "* Your request to frisk %s (ID: %d) has been sent, they must '/accept frisk' first.", GetPlayerNameEx(giveplayerid), giveplayerid);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

		    format(string, sizeof(string), "* %s is requesting to frisk you, type '/accept frisk' to accept.", GetPlayerNameEx(playerid));
			SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
		}
	} else return SendClientMessage(playerid, COLOR_GREY, "You're too far away!");
	return 1;
}
Also this is my Admin Code

Код:
pAdmin
+1 Rep!
Reply
#2

Try this

Код:
CMD:checkinventory(playerid, params[]) 
{
	if(pAdmin[playerid] >= 2)
	{
	new string[128], giveplayerid;

	if(sscanf(params, "u", giveplayerid))
		return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /frisk [playerid/partofname]");

 	if(giveplayerid == INVALID_PLAYER_ID)
	 	return SendClientMessage(playerid, COLOR_GREY, "You can't frisk this player as they're not connected.");

	if(ProxDetectorS(8.0, playerid, giveplayerid)) {
		if(giveplayerid == playerid)
			return SendClientMessage(playerid, COLOR_GREY, "You can't frisk yourself!");

		if(giveplayerid == INVALID_PLAYER_ID)
		    return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");

		if(IsACop(playerid) || PlayerInfo[playerid][pJob] == 8 || PlayerInfo[playerid][pJob2] == 8 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pDivision] == 2) || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 5)) {
			SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
			format(string, sizeof(string), "*** %s' items...  ***", GetPlayerNameEx(giveplayerid));
			SendClientMessage(playerid, COLOR_WHITE, string);

			if(PlayerInfo[giveplayerid][pWSeeds] == 1)
				SendClientMessage(playerid, COLOR_GREY, "Marijuana Seeds");

			if(PlayerInfo[giveplayerid][pPhoneBook] > 0)
				SendClientMessage(playerid, COLOR_GREY, "Phone book.");

			if(PlayerInfo[giveplayerid][pCDPlayer] > 0)
				SendClientMessage(playerid, COLOR_GREY, "CD player.");

			if(PlayerInfo[giveplayerid][pRadio] > 0) {
				format(string, sizeof(string), "Portable radio (frequency #%d kHz)", PlayerInfo[giveplayerid][pRadioFreq]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}

			if(PlayerInfo[giveplayerid][pCarLic] > 0)
				SendClientMessage(playerid, COLOR_GREY, "Driver's license.");

			if(PlayerInfo[giveplayerid][pBoatLic] > 0)
				SendClientMessage(playerid, COLOR_GREY, "Boat driver's license.");

			if(PlayerInfo[giveplayerid][pFlyLic] > 0)
				SendClientMessage(playerid, COLOR_GREY, "Pilot's license.");

			if(PlayerInfo[giveplayerid][pCrack] > 0) {
				format(string, sizeof(string), "%d grams of crack.", PlayerInfo[giveplayerid][pCrack]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}
			if(PlayerInfo[giveplayerid][pPot] > 0) {
				format(string, sizeof(string), "%d grams of pot.", PlayerInfo[giveplayerid][pPot]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}
			if(PlayerInfo[giveplayerid][pMats] > 0) {
				format(string, sizeof(string), "%d materials.", PlayerInfo[giveplayerid][pMats]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}
			if(Fishes[giveplayerid][pWeight1] > 0 || Fishes[giveplayerid][pWeight2] > 0 || Fishes[giveplayerid][pWeight3] > 0 || Fishes[giveplayerid][pWeight4] > 0 || Fishes[giveplayerid][pWeight5] > 0) {
				format(string, sizeof(string), "%d fish.", PlayerInfo[giveplayerid][pFishes]);
				SendClientMessage(playerid, COLOR_GREY, string);
			}

			new weaponname[50];
			format(string, sizeof(string), "*** %s' weapons...  ***", GetPlayerNameEx(giveplayerid));
			SendClientMessage(playerid, COLOR_WHITE, string);

			for(new i = 0; i < 12; i++) {
				if(PlayerInfo[giveplayerid][pGuns][i] > 0) {
					GetWeaponName(PlayerInfo[giveplayerid][pGuns][i], weaponname, sizeof(weaponname));
					format(string, sizeof(string), "Weapon: %s.", weaponname);
					SendClientMessage(playerid, COLOR_GRAD1, string);
				}
			}

			SendClientMessage(playerid, COLOR_GREEN, "_______________________________________");
			format(string, sizeof(string), "* %s has frisked %s.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		} else {
		    SetPVarInt(giveplayerid, "FriskREQ", playerid);

		    format(string, sizeof(string), "* Your request to frisk %s (ID: %d) has been sent, they must '/accept frisk' first.", GetPlayerNameEx(giveplayerid), giveplayerid);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

		    format(string, sizeof(string), "* %s is requesting to frisk you, type '/accept frisk' to accept.", GetPlayerNameEx(playerid));
			SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
		}
	} else return SendClientMessage(playerid, COLOR_GREY, "You're too far away!");
	}
	return 1;
}
If it doesn't work show me your whole Admin code , then i can give you accurate coding...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)