Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: VK.Jona83Killer on Sep 24, 2017, 12:39 AM

Title: I need a system to create pickups and store them in the database
Post by: VK.Jona83Killer on Sep 24, 2017, 12:39 AM
Hello, could you give me a system to create pickups with a command and to be saved in the database?
Title: Re: I need a system to create pickups and store them in the database
Post by: Zone_Killer on Sep 24, 2017, 04:28 AM
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 );
}
Title: Re: I need a system to create pickups and store them in the database
Post by: VK.Jona83Killer on Sep 24, 2017, 04:40 AM
Thanks Bro :)
Title: Re: I need a system to create pickups and store them in the database
Post by: =RK=MarineForce on Dec 21, 2017, 02:12 PM
its nice working

Title: Re: I need a system to create pickups and store them in the database
Post by: umar4911 on Dec 21, 2017, 02:43 PM
https://forum.vc-mp.org/?topic=295.0 See this before making topic and if solved, then press the solved button
Title: Re: I need a system to create pickups and store them in the database
Post by: =RK=MarineForce on Dec 21, 2017, 02:56 PM
And how to save

object dta


Cars in database

can we /addcar carid
Title: Re: I need a system to create pickups and store them in the database
Post by: umar4911 on Dec 22, 2017, 01:58 AM
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