SA-MP Forums Archive
Rob player - 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: Rob player (/showthread.php?tid=254296)



Rob player - Admigo - 10.05.2011

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

Thanks Admigo


Re: Rob player - Biesmen - 10.05.2011

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.


Re: Rob player - Ruto - 10.05.2011

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


Re: Rob player - Admigo - 10.05.2011

Thanks guys i well test it later


Re: Rob player - Admigo - 10.05.2011

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


Re: Rob player - Biesmen - 10.05.2011

low: 25, high: 50!


Re: Rob player - Cameltoe - 10.05.2011

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.


Re: Rob player - Admigo - 11.05.2011

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


Re: Rob player - Mike Garber - 11.05.2011

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?


Re: Rob player - Biesmen - 11.05.2011

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

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