Hello, could you give me a system to create pickups with a command and to be saved in the database?
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 );
}
Thanks Bro :)
its nice working
https://forum.vc-mp.org/?topic=295.0 See this before making topic and if solved, then press the solved button
And how to save
object dta
Cars in database
can we /addcar carid
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