Loot questions
#1

Hello I'm using a loot system which spawns random items on the floor etc and I've made Cookies as loot as I have the servers currency to cookies the only problem is that the inventory system requires you to use the item before having the effect done.
For example:
Код:
OnPlayerUseItem(playerid,ItemName[])
{
	if(!strcmp(ItemName,"Cookie",true))
	{
            if(pInfo[playerid][pCookies] += 1) return SendClientMessage(playerid,-1,"*"COL_WHITE" You have added one cookie to your currency.You can eat your cookies with /eatcookie.");
	    pInfo[playerid][pCookies] += 1;
	    RemoveSlotToInventory(playerid,"Cookie",1);
	}
}
Код:
pInfo[playerid][pCookies] += 1;
Makes it so when the loot is used it adds the Cookie to the currency but I want it so that when I pick up the loot it automaticly adds the Cookie to the currency without having to use it
May I be assisted please?
Reply
#2

pInfo[playerid][pCookies] += 1;

That's the correct line. Which is displayed above.
Reply
#3

Quote:
Originally Posted by BleverCastard
Посмотреть сообщение
pInfo[playerid][pCookies] += 1;

That's the correct line. Which is displayed above.
Please read again at the end I want to make it so when I pick up the loot it doesnt go to my inventory but to my currency.
Reply
#4

OnPlayerUseItem(playerid,ItemName[])

So this is saying: When a player uses the item with the name "cookie" execute the code inside my body.

So it's not in this callback.
Reply
#5

I don't think you understand I want to make a callback so that whenever I find the loot "Cookie" and when I pick it up it doesnt go to my inventory but directly to the currency so its kinda like Automaticly pressing the Use button for you if you understand me.
Reply
#6

So, something like this?

PHP код:
OnPlayerPickupItem(playerid,ItemName[])
{
    if(!
strcmp(ItemName,"Cookie",true))
    {
        
pInfo[playerid][pCookies] += 1;
    }

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)