View Full Version : Rob cmd

07/08/2012, 11:48 AM
Hello guys i was thinking about learning rob command.I know how to take all player money and give it to another player but thats not what i want. I want that /rob commands take different amount of money,not all.Eg. i have 300,000 and someone comes to rob me, ill lose sometimes 10 000, sometimes 26 000 sometiems 120 500 etc...so i want randomize stolen money.
I use:

07/08/2012, 01:38 PM
make it then

07/08/2012, 01:43 PM
new money = GetPlayerMoney(targetid);//we get the targets money and store it in the money variable
new givenmoney = random(money);//here we randomize the money of the target, and store it in the new variable
GivePlayerMoney(playerid,givenmoney);//we give the randomized amount of money to the player

I hope this would bring you a little further

07/08/2012, 05:36 PM
Darren i said i know how to make that command but i dont know how to randomize taken money.

Jari thanks ill try it right now

07/08/2012, 05:46 PM
Ahh i understand randomizing now but could you tell me how to take that randomzied money? as there isnt take money all i can do is reset but thats not it...if i have 300k and someones takes from me 100k i cant have 0$ lol i need to have 200k

07/08/2012, 05:50 PM
well, what i gave you is jut a basic code, and you can use that code to do almost everything to the money of you and the target..
if you want to take the amount of money, selected by the random maker, you just do, GivePlayerMoney(target,-givenmoney);
you basically to giveplayermoney, but you put a minus(-) before it, so the script takes it away
this only if you use my code, i don't know how you coded the command you have now..
if it is different, post it here, then i can have a look at it.

07/08/2012, 06:30 PM
Ive tryed that but it didnt work...im re writing that command maybe i failed somewhere.Anyway thanks for help, rep +

07/08/2012, 06:36 PM
thanks for the rep ;)
anyways, if it still doesn't work, just post it, and i will have a look at it..
it could be the smallest thing that causes it to not work.