Rob player
#1

Heey guys
I want to make a robber skill.
But how can i make that the player gets (number)% of the money?

Thanks Admigo
Reply
#2

pawn Код:
// At the /rob command:
new RobMoney = GetPlayerMoney(RobberID)*0.25;
GivePlayerMoney(playerid, RobMoney);
GivePlayerMoney(RobberId, -RobMoney);
This will give 25 percent to the player who robs, and it will take 25 percent of the player who's being robbed.

To get a good script, I'd suggest you to pay more attention to your math lessons.
Reply
#3

This is GetPlayerMoney(RobberID)*0.25 for 25 percent, I think.
Reply
#4

Thanks guys i well test it later
Reply
#5

I want to make low robber and high robber. Anyone know good precent for low and high?
Reply
#6

low: 25, high: 50!
Reply
#7

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
low: 25, high: 50!
Here's how i would done it

first off with some defines :
pawn Код:
#define SKILL_ROB 1
I assume you have an pInfo enumerator, now let's make yet another one.
pawn Код:
enum pSkills
{
     Rob,
}
new PlayerSkills[MAX_PLAYERS][pSkills];
pawn Код:
stock GetPlayerSkill(playerid, skillid)
{
     if(skillid == SKILL_ROB) return PlayerSkills[playerid][Rob];
     return 0;
}
pawn Код:
stock GivePlayerSkill(playerid, skillid, amount)
{
     if(skillid == SKILL_ROB) PlayerSkills[playerid][Rob] += amount;
     return 1;
}
pawn Код:
stock SetPlayerSkill(playerid, skillid, amount)
{
     if(skillid == SKILL_ROB) PlayerSkills[playerid][Rob] = amount;
     return 1;
}
Now when you "rob" an person you could check the chances by skill level, do the percentage by skill level etc good luck.
Reply
#8

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
pawn Код:
// At the /rob command:
new RobMoney = GetPlayerMoney(RobberID)*0.25;
GivePlayerMoney(playerid, RobMoney);
GivePlayerMoney(RobberId, -RobMoney);
This will give 25 percent to the player who robs, and it will take 25 percent of the player who's being robbed.

To get a good script, I'd suggest you to pay more attention to your math lessons.
I get error from the percent:Mismatch
Reply
#9

Why all this percentage for a robbing script? If it is for a roleplay server, ask yourself, if you rob somebody, do you go there and say "HEY GIVE ME 25% OF YOUR MONEY NOW!"

No, you would take ALL of his cash. No, it's not what the rob-victim wants, but would it be in real life?
If it is a roleplay server you should make sure to keep most of your money at the bank, who the hell walks around with thousands of dollars every day?
Reply
#10

@Mike_Garber; It's a cop and robbers server, check his signature.

@admigo
pawn Код:
new RobMoney = floatround( floatmul( GetPlayerMoney(RobberID), 0.25 ), floatround_ceil );
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)