Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "\life_server\script_macros.hpp"
- /*
- File: fn_insertRequest.sqf
- Author: Bryan "Tonic" Boardwine
- Description:
- Adds a player to the database upon first joining of the server.
- Recieves information from core\sesison\fn_insertPlayerInfo.sqf
- */
- private["_queryResult","_query","_alias"];
- params [
- "_uid",
- "_name",
- ["_money",-1,[0]],
- ["_bank",-1,[0]],
- ["_returnToSender",objNull,[objNull]]
- ];
- //Error checks
- if ((_uid isEqualTo "") || (_name isEqualTo "")) exitWith {systemChat "Bad UID or name";}; //Let the client be 'lost' in 'transaction'
- if (isNull _returnToSender) exitWith {systemChat "ReturnToSender is Null!";}; //No one to send this to!
- _query = format["INSERT INTO players (playerid, name, cash, bankacc, aliases, cop_licenses, med_licenses, civ_licenses, aaf_licenses, aaf_gear, civ_gear, cop_gear, med_gear) VALUES('%1', '%2', '%3', '%4', '%5','"[]"','"[]"','"[]"','"[]"','"[]"','"[]"','"[]"','"[]"')"];
- _tickTime = diag_tickTime;
- _queryResult = [_query,2] call DB_fnc_asyncCall;
- if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
- diag_log "------------- Insert Query Request -------------";
- diag_log format["QUERY: %1",_query];
- diag_log format["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)];
- diag_log format["Result: %1",_queryResult];
- diag_log "------------------------------------------------";
- };
- //Double check to make sure the client isn't in the database...
- if (_queryResult isEqualType "") exitWith {[] remoteExecCall ["SOCK_fnc_dataQuery",(owner _returnToSender)];}; //There was an entry!
- if (count _queryResult != 0) exitWith {[] remoteExecCall ["SOCK_fnc_dataQuery",(owner _returnToSender)];};
- //Clense and prepare some information.
- _name = [_name] call DB_fnc_mresString; //Clense the name of bad chars.
- _alias = [[_name]] call DB_fnc_mresArray;
- _money = [_money] call DB_fnc_numberSafe;
- _bank = [_bank] call DB_fnc_numberSafe;
- //Prepare the query statement..
- _query = format["INSERT INTO players (playerid, name, cash, bankacc, aliases, cop_licenses, med_licenses, civ_licenses, civ_gear, cop_gear, med_gear) VALUES('%1', '%2', '%3', '%4', '%5','"[]"','"[]"','"[]"','"[]"','"[]"','"[]"','"[]"','"[]"')",
- _uid,
- _name,
- _money,
- _bank,
- _alias
- ];
- [_query,1] call DB_fnc_asyncCall;
- [] remoteExecCall ["SOCK_fnc_dataQuery",(owner _returnToSender)];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement