SA-MP Forums Archive
Need help :) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help :) (/showthread.php?tid=175111)



Need help :) - Matej_ - 08.09.2010

How can I detect if player has bought some stuff from a shop.
Example: If he has bought a Watch or maybe MP3 or drink from a 24/7 (example from Roleplay)

And then I need to know letґs say if he has bought a watch that he cant use it
if he didnt bought it.

Thanks for the help !


Re: Need help :) - mrcoolballs - 08.09.2010

have you created it so the player can buy something from the shop, because nobody wants to explian the entire proccess of scripting how to buy something from a shop, then detecting what was bought


Re: Need help :) - Matej_ - 08.09.2010

Quote:
Originally Posted by mrcoolballs
Посмотреть сообщение
have you created it so the player can buy something from the shop, because nobody wants to explian the entire proccess of scripting how to buy something from a shop, then detecting what was bought
I know how to create that player can buy something from a shop,
I just need to know how to detect is he has bought that and if he hasnt bought it.


Re: Need help :) - cessil - 08.09.2010

use variables.

you're welcome for the help!


Re: Need help :) - mrcoolballs - 08.09.2010

create a variable
pawn Код:
new BoughtItem[MAX_PLAYERS];
then when the player buys the item:
pawn Код:
BoughtItem[playerid] = 1;
and then when you want to check if the player has bought the item:
pawn Код:
if(BoughtItem[playerid] == 1)
{
    // do stuff
}
else
{
    //player hasn't bought the item
    return 1;
}



Re: Need help :) - Matej_ - 08.09.2010

Quote:
Originally Posted by mrcoolballs
Посмотреть сообщение
create a variable
pawn Код:
new BoughtItem[MAX_PLAYERS];
then when the player buys the item:
pawn Код:
BoughtItem[playerid] = 1;
and then when you want to check if the player has bought the item:
pawn Код:
if(BoughtItem[playerid] == 1)
{
    // do stuff
}
else
{
    //player hasn't bought the item
    return 1;
}
ok thanks I am going to try if it works !