NIkita Bel

Making mod

7 posts in this topic

Hi! I'm new in SQF syntax, but have experience on other programming languages.. i want to made my first small app/mod. What this app (or mod) will do:

1. When player buys vehicle, players UID must be stored with vehicle data in 'player_uid' column in 'vehicle' table in Exile DB.

2. When any player wants to sell vehicle - check must be performed:

     if vehicle.player_uid is not Null:

             if player.uid != vehicle.player_uid:

                    throw error: "Only owner can sell this vehicle!"

                    brake sell process

 This is starting functionality..  

Can someone help me with development process - point where to read, how to organize code? 

Share this post


Link to post
Share on other sites
_playerUID = (getPlayerUID _playerObject);

if !(_playerUID isEqualTo (_vehicleObject getVariable "ExileOwnerUID")) then
{
	throw "You're not the owner of this vehicle!";
};

I'll leave it to you to figure out WHERE.

But it goes inside the try/catch in -

ExileServer_system_trading_network_WasteDumpRequest

@NIkita Bel

Share this post


Link to post
Share on other sites
Advertisement
58 minutes ago, Mezo said:

_playerUID = getPlayerUID _playerObject;

if (_playerUID != (_vehicleObject getVariable "ExileOwnerUID")) throw "You're not the owner of this vehicle!";

I'll leave it to you to figure out WHERE.

But it goes inside the try/catch in -


ExileServer_system_trading_network_WasteDumpRequest

@NIkita Bel

even better syntax ;)

Edited by StokesMagee

Share this post


Link to post
Share on other sites
7 minutes ago, StokesMagee said:

even better syntax ;)

 

51 minutes ago, Mezo said:

_playerUID = (getPlayerUID _playerObject);

if !(_playerUID isEqualTo (_vehicleObject getVariable "ExileOwnerUID")) then
{
	throw "You're not the owner of this vehicle!";
};

I'll leave it to you to figure out WHERE.

But it goes inside the try/catch in -


ExileServer_system_trading_network_WasteDumpRequest

@NIkita Bel

Thx alot! Bu how can i store UID in DB table? I realize i need to send NetworkMessage request, but in 'purchaseVehicleRequest' from CfgNetworkMessages there is no UID  parameter. Do i need to write own request function? 

Share this post


Link to post
Share on other sites
9 minutes ago, NIkita Bel said:

Thx alot! Bu how can i store UID in DB table? I realize i need to send NetworkMessage request, but in 'purchaseVehicleRequest' from CfgNetworkMessages there is no UID  parameter. Do i need to write own request function? 

You're able to access the UID of the player on the server by doing, and the owner UID of the vehicle is already stored in the database, that's what the "_vehicleObject getVariable 'ExileOwnerUID'"

_playerUID = getPlayerUID _playerObject;
Edited by StokesMagee

Share this post


Link to post
Share on other sites
4 minutes ago, StokesMagee said:

You're able to access the UID of the player on the server by doing 


_playerUID = getPlayerUID _playerObject;

yes, but how can i write UID to database,  on vehicle object creation into the table 'vehicle', in same row, in column 'player_uid' ?  

Share this post


Link to post
Share on other sites
3 minutes ago, NIkita Bel said:

yes, but how can i write UID to database,  on vehicle object creation into the table 'vehicle', in same row, in column 'player_uid' ?  

use this to create the vehicle:

_vehicleObject = [_vehicleClass, _position, (random 360), true, _pinCode] call ExileServer_object_vehicle_createPersistentVehicle;

then set these 3 variables:

_vehicleObject setVariable ["ExileOwnerUID", (getPlayerUID _playerObject)];

_vehicleObject setVariable ["ExileIsLocked",0];

_vehicleObject lock 0;

then, execute these 2 update functions, and problem solved:

_vehicleObject call ExileServer_object_vehicle_database_insert;
_vehicleObject call ExileServer_object_vehicle_database_update;

 

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.