Same amount! - 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)
+--- Thread: Same amount! (
/showthread.php?tid=656839)
Same amount! -
Man43 - 25.07.2018
Hi i've creating a bail command but when someone be jailed the amount jailed will be differnt of orginal bail amount it's changed automacily why..
PHP Code:
if(BailPlayer[playerid] == 1)
{
new bailplayerr = random(7000) + 1000;
if(bailplayerr > GetPlayerCash(playerid))
{
if(GetPlayerMoney(playerid) < bailplayerr) return SendClientMessage(playerid, COLOR_RED, "{FF0000}Error: {FFFFFF}You don't have engouh money to bail yourself.");
PHP Code:
forward pJailTimer(playerid);
public pJailTimer(playerid)
{
new bailplayerr = random(7000) + 1000;
RemovePlayerAttachedObject(playerid, 9);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
PlayerInfo[playerid][pJailed] = 1;
pJailCount[playerid]--;
new string[128];
format(string, sizeof(string), "%d", pJailCount[playerid]);
TextDrawSetString(Textdraw1, string);
format(string, sizeof(string), "$%d", bailplayerr);
How to Stop changing alot of amount's I just want Random Bail amount from 7k - 1k but they giving me a changing amounts...
Re: Same amount! -
Man43 - 25.07.2018
ANYONE ??21
Re: Same amount! -
Florin48 - 25.07.2018
stores the money in a variable.
PHP Code:
new MoneyForBail[MAX_PLAYERS]; // global variable, reset at OnPlayerConnect
if(BailPlayer[playerid] == 1)
{
MoneyForBail[playerid] = random(7000) + 1000;
if(MoneyForBail[playerid] > GetPlayerCash(playerid))
{
if(GetPlayerMoney(playerid) < MoneyForBail[playerid]) return SendClientMessage(playerid, COLOR_RED, "{FF0000}Error: {FFFFFF}You don't have engouh money to bail yourself.");
....
forward pJailTimer(playerid);
public pJailTimer(playerid)
{
RemovePlayerAttachedObject(playerid, 9);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
PlayerInfo[playerid][pJailed] = 1;
pJailCount[playerid]--;
new string[128];
format(string, sizeof(string), "%d", pJailCount[playerid]);
TextDrawSetString(Textdraw1, string);
format(string, sizeof(string), "$%d", MoneyForBail[playerid]);
...
MoneyForBail[playerid] = 0;
Re: Same amount! -
Man43 - 25.07.2018
Hi I can do if someone bail a player they sending mesasge to All Example:
%s(%d) has pay the bail of the jailed to %s(%d) How to do if someone bail him from jail
Thank you for fixing random money..
Re: Same amount! -
Florin48 - 25.07.2018
you can use format(...
PHP Code:
new string[128], name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
GetPlayerName(playerid, name1, sizeof(name1));
GetPlayerName(id, name2, sizeof(name2));
format(string,sizeof(string),"%s(%d) has pay the bail of the jailed to %s(%d)",name1,playerid,name2,id);
SendClientMessageToAll(string, color);
that id is the one who put him in the jail.
to have it in your previous order, you can store it in the variable.
ex:
PHP Code:
JailedIDto[id] = playerid;
when he uses command / jail or what command you have there.
that's what you should do, I hope you understand.