SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/07/2018, 07:38 AM   #1
Man43
Huge Clucker
 
Man43's Avatar
 
Join Date: Feb 2017
Posts: 250
Reputation: 0
Default Same amount!

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(playeridCOLOR_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(playerid9);
    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_NONE);
    
PlayerInfo[playerid][pJailed] = 1;
    
pJailCount[playerid]--;
    new 
string[128];
    
format(stringsizeof(string), "%d"pJailCount[playerid]);
    
TextDrawSetString(Textdraw1string);
    
format(stringsizeof(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...
Man43 is offline   Reply With Quote
Old 25/07/2018, 09:43 AM   #2
Man43
Huge Clucker
 
Man43's Avatar
 
Join Date: Feb 2017
Posts: 250
Reputation: 0
Default Re: Same amount!

ANYONE ??21
Man43 is offline   Reply With Quote
Old 25/07/2018, 10:02 AM   #3
Florin48
Huge Clucker
 
Join Date: Nov 2015
Location: Romania
Posts: 266
Reputation: 5
Default Re: Same amount!

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(playeridCOLOR_RED"{FF0000}Error: {FFFFFF}You don't have engouh money to bail yourself.");
      ....

            
            
forward pJailTimer(playerid); 
public 
pJailTimer(playerid

    
RemovePlayerAttachedObject(playerid9); 
    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_NONE); 
    
PlayerInfo[playerid][pJailed] = 1
    
pJailCount[playerid]--; 
    new 
string[128]; 
    
format(stringsizeof(string), "%d"pJailCount[playerid]); 
    
TextDrawSetString(Textdraw1string); 
    
format(stringsizeof(string), "$%d"MoneyForBail[playerid]);
    ...
    
MoneyForBail[playerid] = 0
Florin48 is offline   Reply With Quote
Old 25/07/2018, 12:13 PM   #4
Man43
Huge Clucker
 
Man43's Avatar
 
Join Date: Feb 2017
Posts: 250
Reputation: 0
Default Re: Same amount!

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..
Man43 is offline   Reply With Quote
Old 25/07/2018, 12:21 PM   #5
Florin48
Huge Clucker
 
Join Date: Nov 2015
Location: Romania
Posts: 266
Reputation: 5
Default Re: Same amount!

you can use format(...

PHP Code:
new string[128], name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
GetPlayerName(playeridname1sizeof(name1));
GetPlayerName(idname2sizeof(name2));
format(string,sizeof(string),"%s(%d) has pay the bail of the jailed to %s(%d)",name1,playerid,name2,id);
SendClientMessageToAll(stringcolor); 
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.
Florin48 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
max amount [+rep] iBots Scripting Help 7 17/04/2015 10:51 AM
/td [amount] AIMigboboy Scripting Help 3 26/08/2013 12:14 AM
how to get the amount? Sascha Scripting Help 6 04/11/2011 09:28 PM
How Do I Do This? On Screen Amount Of Kills And amount Of Deaths HayZatic Help Archive 1 01/07/2011 02:26 PM
Exp amount juuleman Help Archive 11 23/11/2009 03:35 PM


All times are GMT. The time now is 10:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.