Loot questions - 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: Loot questions (
/showthread.php?tid=570812)
Loot questions -
Hybris - 13.04.2015
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?
Re: Loot questions -
BleverCastard - 13.04.2015
pInfo[playerid][pCookies] += 1;
That's the correct line. Which is displayed above.
Re: Loot questions -
Hybris - 13.04.2015
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.
Re: Loot questions -
BleverCastard - 13.04.2015
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.
Re: Loot questions -
Hybris - 13.04.2015
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.
Re: Loot questions -
BleverCastard - 13.04.2015
So, something like this?
PHP код:
OnPlayerPickupItem(playerid,ItemName[])
{
if(!strcmp(ItemName,"Cookie",true))
{
pInfo[playerid][pCookies] += 1;
}
}