Command Problem
#1

Well, I have a little problem. I made this command but seems that when I do /inventory , it shows only ID 0's Inventory. I already tested it.

Код:
CMD:inventory(playerid, params[])
{
    new playerb, string[128];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
   	SendClientMessage(playerid, COLOR_ORANGE, "Your Inventory:");
	format(string, sizeof(string), "Packages: %s | Materials: %d | Weed: %d | Crack: %d | Cigar: %d | Sprunk: %d | Ropes: %d | Blindfolds: %d", RPPN(playerb), PlayerInfo[playerb][pMaterials], PlayerInfo[playerb][pWeed], PlayerInfo[playerb][pCrack], PlayerInfo[playerb][pCigar], PlayerInfo[playerb][pSprunk], PlayerInfo[playerb][pRope], PlayerInfo[playerb][pBlindfold]);
	SendClientMessage(playerid, COLOR_WHITE, string);
	return 1;
}
Reply
#2

Why are you creating playerb, when you do new playerb it is automatically set to a value of 0 by default. Try using if(sscanf(params, ... etc. etc.
Is this for you to check your own inventory, or you can check either your own or others inventories?
Reply
#3

Nevermind. I found out the problem. I forgot to write playerb = playerid
Reply
#4

There's no real need for playerb, just change all playerb values to playerid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)