crimes random value
crimes random value
is there anyone who can give me the code to a random value gain in crimes/jobs
something like =rand(2,5)*1;
something like =rand(2,5)*1;
Re: crimes random value
for now i have something like this and i think/hope i'm close to a good result
$v=rand(3,7)*1;/*rnd*/$userStats["!currency"]->value+=$v;
ResultMessage("Pickpocket successful you got money.");
also would like to know how to give a random item
example i have car item and i want to make a car theft crime that gives a random car
$v=rand(3,7)*1;/*rnd*/$userStats["!currency"]->value+=$v;
ResultMessage("Pickpocket successful you got money.");
also would like to know how to give a random item
example i have car item and i want to make a car theft crime that gives a random car
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: crimes random value
Sorry I must have missed this earlier. Looks like you have it figured out though.
For a random item there is an Id column in the objects table. You could just do another random number and then select by id = that number. This however would grab ANY item so you may want to make a new table that you place objects Id in there that you want to be randomly picked from and have a new Id for those.
For a random item there is an Id column in the objects table. You could just do another random number and then select by id = that number. This however would grab ANY item so you may want to make a new table that you place objects Id in there that you want to be randomly picked from and have a new Id for those.
Re: crimes random value
the code in my last post is not working
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: crimes random value
what error are you getting?
Re: crimes random value
Error in evaluated code:
$v=rand(3,7)*1;/*rnd*/$userStats["!currency"]->value+=$v;
ResultMessage("Pickpocket successful you got money.");
$v=rand(3,7)*1;/*rnd*/$userStats["!currency"]->value+=$v;
ResultMessage("Pickpocket successful you got money.");
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: crimes random value
$v=rand(3,7)*1;
$userStats["!currency"]->value+=$v;
ResultMessage("Pickpocket successful you got money.");
not that it matters but you dont need the *1
to debug put this in to see what is working and whats not
echo "random = " . $v;
echo "currency=" . $userStats["!currency"]->value;
$userStats["!currency"]->value+=$v;
ResultMessage("Pickpocket successful you got money.");
not that it matters but you dont need the *1
to debug put this in to see what is working and whats not
echo "random = " . $v;
echo "currency=" . $userStats["!currency"]->value;
Re: crimes random value
found it
!currency needs to be with a big C !Currency
!currency needs to be with a big C !Currency
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: crimes random value
Ha! its the little things.
Re: crimes random value
So for the others who want to use this line
this is the good line
$v=rand(3,7)*1;
$userStats["!Currency"]->value+=$v;
ResultMessage("Pickpocket succesful you got $v !Currency .");
this is the good line
$v=rand(3,7)*1;
$userStats["!Currency"]->value+=$v;
ResultMessage("Pickpocket succesful you got $v !Currency .");