Jump to content
Sign in to follow this  
Aphec

Breaking my head on this script

Recommended Posts

So i'm working on Altis life mission and there is a possibility for the cop to give a ticket to a player, who then pays the ticket, the money gets deducted from his bankaccount and done, now i want the money of the payed ticket to go to the guy who gave the ticket.

i'm digging trough the files to get the code working but i just cant,

so there is 1 scriptfile, this is the code to GIVE the ticket to the person

	Description:
Gives a ticket to the targeted player.
*/
private["_val"];
if(isNil {life_ticket_unit}) exitWith {hint "Person to ticket is nil"};
if(isNull life_ticket_unit) exitWith {hint "Person to ticket doesn't exist."};
_val = ctrlText 2652;
if(!([_val] call fnc_isnumber)) exitWith {hint "You didn't enter actual number format."};
if((parseNumber _val) > 100000) exitWith {hint "Tickets can not be more than $100,000!"};
[[0,format["%1 gave a ticket of $%2 to %3",name player,[(parseNumber _val)] call life_fnc_numberText,name life_ticket_unit]],"life_fnc_broadcast",true,false] spawn life_fnc_MP;
[[player,(parseNumber _val)],"life_fnc_ticketPrompt",life_ticket_unit,false] spawn life_fnc_MP;
closeDialog 0;

and this is the code to Pay the ticket, surely i must be able to put a variable somewhere who checks who gave the ticket and then give the money to that person

	Pays the ticket.
*/
if(isnil {life_ticket_val} OR isNil {life_ticket_cop}) exitWith {};
if(life_cash < life_ticket_val) exitWith
{
if(life_atmcash < life_ticket_val) exitWith 
{
	hint "You don't have enough money in your bank account or on you to pay the ticket.";
	[[1,format["%1 couldn't pay the ticket due to not having enough money.",name player]],"life_fnc_broadcast",life_ticket_cop,false] spawn life_fnc_MP;
	closeDialog 0;
};
hint format["You have paid the ticket of $%1",[life_ticket_val] call life_fnc_numberText];
life_atmcash = life_atmcash - life_ticket_val;
life_ticket_paid = true;
[[0,format["%1 paid the ticket of $%2",name player,[life_ticket_val] call life_fnc_numberText]],"life_fnc_broadcast",west,false] spawn life_fnc_MP;
closeDialog 0;
};

life_cash = life_cash - life_ticket_val;
life_ticket_paid = true;

[[(getPlayerUID player),life_ticket_val],"life_fnc_wantedTicket",false,false] spawn life_fnc_MP;
[[0,format["%1 paid the ticket of $%2",name player,[life_ticket_val] call life_fnc_numberText]],"life_fnc_broadcast",west,false] spawn life_fnc_MP;
closeDialog 0;
[[1,format["%1 paid the ticket.",name player]],"life_fnc_broadcast",life_ticket_cop,false] spawn life_fnc_MP;

basically in the end we should have something i suppose like

life_cash = life_cash - life_ticket_val + life_cash_cop

or something, unfortunately i'm not talented enough to get it to work :( if anyone wants to help out, it would be GREATLY appreciated.

The reason i asking help here is because Tonic has got his head on a new project ( which i fully understand ) :)

Share this post


Link to post
Share on other sites

If this is tonics mission I thought i had the cop number on it? Like cop # gave civ # a ticket? Right?

Share this post


Link to post
Share on other sites

[[0,format["%1 paid the ticket of $%2",name player,[life_ticket_val] call life_fnc_numberText]],"life_fnc_broadcast",west,false] spawn life_fnc_MP;

states that %1 gave the ticket,

now just dont know how to find out how to give the money from life_ticket_val to %1

Share this post


Link to post
Share on other sites

life_ticket_cop

*Edit*

%1 is just a formatting for the format command. What is passed to %1 is name player as you would see in the code. life_ticket_cop is used to track the officer who gave the ticket so that he is notified which you would see in the script. life_ticket_val & life_ticket_cop is all set and tracked from fn_ticketPrompt.sqf

Share this post


Link to post
Share on other sites
life_ticket_cop

*Edit*

%1 is just a formatting for the format command. What is passed to %1 is name player as you would see in the code. life_ticket_cop is used to track the officer who gave the ticket so that he is notified which you would see in the script. life_ticket_val & life_ticket_cop is all set and tracked from fn_ticketPrompt.sqf

ok i now understand how your %1 & %2 works, but where do i add the line to give the money to the cop?

i'm scrolling trough the ticketprompt & the ticketpay, but i dont really see the script that executes the command

---------- Post added at 14:05 ---------- Previous post was at 13:42 ----------

if i look at the ticketPay

hint format["You have paid the ticket of $%1",[life_ticket_val] call life_fnc_numberText];

life_atmcash = life_atmcash - life_ticket_val;

life_ticket_paid = true;

[[0,format["%1 paid the ticket of $%2",name player,[life_ticket_val] call life_fnc_numberText]],"life_fnc_broadcast",west,false] spawn life_fnc_MP;

closeDialog 0;

i suppose the command to deduct money from the players bank account is life_atmcash = life_atmcash - life_ticket_val;

now i suppose an extra line of code will need to be added somewhere to then do

cop_bankaccount = life_atmcash + life_ticket_val ( and then a command to give that money to the cops account? )

Edited by Aphec

Share this post


Link to post
Share on other sites
[[[life_ticket_val],{life_atmcash = life_atmcash + (_this select 0);}],"BIS_fnc_call",life_ticket_cop,false] spawn life_fnc_MP;

Share this post


Link to post
Share on other sites

Error in expression <life_atmcash = life_atmcash + (_this select 0);>

Error position: <+ (_this select 0);>

Error Generic error in expression

added your coding line behind

life_atmcash = life_atmcash - life_ticket_val;

Share this post


Link to post
Share on other sites

dont worry :) i found the bug :) it was a small ; that was missing :)

IT WORKS :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×