Garry's Mod Wiki

sql.Query

Entity:SetVelocity( Vector velocity )

Description

table sql.Query( string query )

Description

Performs a query on the local SQLite database, returns a table as result set, nil if result is empty and false on error.

Arguments

Sets the entity's velocity. For entities with physics, consider using PhysObj:SetVelocity on the PhysObj of the entity.

Actually binds to CBaseEntity::SetBaseVelocity() which sets the entity's velocity due to forces applied by other entities.
If applied to a player, this will actually ADD velocity, not set it.

Arguments

1 string query
The query to execute.

Returns

1 Vector velocity
The new velocity to set.
1 table
false is returned if there is an error, nil if the query returned no data.

Example

Functions that are examples of saving and creating information into the database.

function CreateTable() sql.Query("CREATE TABLE player_data(SteamID TEXT, Money INTEGER)") end function NewPlayerToDataBase(ply) sql.Query("INSERT INTO player_data(SteamID, Money) VALUES('"..ply:SteamID().."', 0)") end function SavePlayerToDatabase(ply, Money) sql.Query("UPDATE player_data SET Money="..Money.." WHERE SteamID='"..ply:SteamID().."'") end

Page Links


Special Pages


Wikis

?

Render Time: 30ms

Session 0
DB GetPage 5
Generate Html 4
SaveChanges 14
Render Body 0
Render Sidebar 6