Jump to content
Sign in to follow this  
dachevs

Money System with Roleplay objects

Recommended Posts

I have recently been trying to create a money script with the Roleplay Objects money.

I can buy cars, and weapons and all, but I have it only to check if there is one type of object in your inventory. But i want the script to check if there is say a "$100" in your inventory and if not then it checks if there are two, then if you have two, it creates the car and removes one "$100" and gives you one "$100".

I'm getting really confused on scripting using objects.

Does anyone know a more simpler way to script using objects as money?

banghead.gifcrazy_o.gif

Share this post


Link to post
Share on other sites

How about the countType command:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_count= "ObjectType" countType magazines player;

Replace ObjectType with the object you want to check for. BTW, I'm pretty sure this works for magazines and weapons as well as vehicles but you have to check to be sure (since isKindOf only check objects in CfgVehicles, I don't know if it is the same for CfgMagazines and CfgWeapons).

As an alternative...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

private ["_count"];

_count = 0;

{if (_x == typeOf "ObjectType") then {_count = _count + 1};} forEach magazines player;

...should also work. Again change "ObjectType" as applicable as well as the array you want to compare against (magazines player, weapons player, etc.)

Share this post


Link to post
Share on other sites

I can't thank you enough.

This should be perfect yay.gif

notworthy.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×