I need a system to create pickups and store them in the database

Started by VK.Jona83Killer, Sep 24, 2017, 12:39 AM

Previous topic - Next topic

VK.Jona83Killer

Hello, could you give me a system to create pickups with a command and to be saved in the database?

Zone_Killer

function onScriptLoad() //Credits To K.D.M Number 1
{
p <- ConnectSQL("Pickups.db");
QuerySQL(p,"CREATE TABLE IF NOT EXISTS Pickups(ID TEXT, Creator VARCHAR(32), X NUMERIC, Y NUMERIC, Z NUMERIC, PickupID TEXT, World NUMERIC )" );
LoadPickups();
}

Command
if ( cmd == "createpick" )
{
if ( !text ) MessagePlayer( ">> Use /" + cmd + " <ID>", player );
else {
CreatePickup(text.tointeger(), Vector (player.Pos.x.tofloat(), player.Pos.y.tofloat(), player.Pos.z.tofloat()));
QuerySQL(p, "INSERT INTO Pickups ( ID, Creator, X, Y, Z, World) values ( '" + text.tointeger() + "', '"+player.Name+"', '" + player.Pos.x + "', '" + player.Pos.y + "', '" + player.Pos.z + "', '"+player.World+"')" );
Message( "Pickup Has Been created" );
}
}

Load Pickups Function
function LoadPickups()
{
local q = QuerySQL( p, "SELECT * FROM Pickups" ), i = 0;
while( GetSQLColumnData( q, 0 ) )
{
local
ID = GetSQLColumnData( q, 0 ),
PX = GetSQLColumnData( q, 2 ),
PY = GetSQLColumnData( q, 3 ),
PZ = GetSQLColumnData( q, 4 );

CreatePickup(ID.tointeger(), Vector(PX.tofloat(), PY.tofloat(), PZ.tofloat()));
GetSQLNextRow( q );
i++;
}
print( "Pickups Loaded - " + i );
}
Bohemia Is God Of Punjabi Rap
Yo Yo Honey Singh tou chutiya hai

VK.Jona83Killer



umar4911

RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

=RK=MarineForce

And how to save

object dta


Cars in database

can we /addcar carid

umar4911

Quote from: =RK=MarineForce on Dec 21, 2017, 02:56 PMAnd how to save

object dta


Cars in database

can we /addcar carid
See the krlozz veh system. It does save it
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter