Show Posts
|
Pages: 1 [2] 3 4 ... 9
|
18
|
Scripting / Script Help / Re: Error.. error.. error..
|
on: July 03, 2012, 06:59:29 pm
|
@ Thijn: Hey mr obvious, it is not. It's the SINGLE query that is supposed to return a float, and there is not a point to put it in a class, because ( obvious ) I use it just once.
passwords, admin level, LCPD Sub-divisions level & other things are obviously stored in a class.
It's still pretty bad when you can just put it all in one query like so: local q = sqlite_query( database, "SELECT X, Y, Z, Skin, Wep, Ammo FROM LASTLOGIN WHERE Name='" + player.Name.toupper() + "' LIMIT 1" );
// x - Column 0 // y - Column 1 // z - Column 2 // etc.
Performing so many queries that could be done in one query could be detrimental to performance down the road. Not only that, but I'll never understand what the hell this is: player.Pos = Vector( sqlite_column_data(sqlite_query(database, "SELECT X FROM LASTLOGIN WHERE Name='"+player.Name.toupper()+"' " ),0), sqlite_column_data(sqlite_query(database, "SELECT Y FROM LASTLOGIN WHERE Name='"+player.Name.toupper()+"' " ),0), sqlite_column_data(sqlite_query(database, "SELECT Z FROM LASTLOGIN WHERE Name='"+player.Name.toupper()+"' " ),0) );
When you could've simply done: local q = sqlite_query( database, "SELECT X, Y, Z FROM LASTLOGIN WHERE Name = '" + player.Name.toupper() + "' LIMIT 1" );
local x = sqlite_column_data( q, 0 ).tofloat(); local y = sqlite_column_data( q, 1 ).tofloat(); local z = sqlite_column_data( q, 2 ).tofloat();
Anyways, if you're still having problems, simply try this code: player.Pos = Vector( 0.0, 0.0, 0.0 );
And see if it still complains about it not being a vector. If that one line works, then I'm going to guess that your problem is that you're performing too many goddamn operations on a single Vector constructor. In that case, try the code further above that deals with the database.
|
|
|
20
|
Off Topic / Spam / Re: a question For the intelligent Only ;D
|
on: June 07, 2012, 11:35:26 pm
|
What is the thing that holds more than 1000 tons and can't carry a nail !!!!
I have no idea. What is the member which is in the human body, that closes when the human sneeze !!!!!
Too easy, eyes.
|
|
|
24
|
Scripting / Scripting Discussion / Re: Player/Vehicle Classes
|
on: April 06, 2012, 03:03:14 pm
|
Unlike a normal Squirrel class, the Player and Vehicle classes are not traditionally extensible (class herp extends derp) due to the way they are implemented. However, upon loading the scripts, you CAN create new slot instances in either class, and they will be accessible through any instance.
function onPlayerJoin( pPlayerInst ) { Player.Herp <- function() // Inserts into base class { ::print( "LOLOLO" ); }
pPlayerInst.Herp(); // Player instance changed dynamically, function works }
EDIT: Should probably add that you should be extending the classes in onScriptLoad (or onServerStart). Doing Player.NewSlot <- in onPlayerJoin isn't healthy.
EDIT 2: This is more kosher.
function hook_Herp() { ::print( "LOLOLO" ); } function onScriptLoad() { Player.Herp <- hook_Herp; } function onPlayerJoin( pPlayer ) { pPlayer.Herp(); }
|
|
|
28
|
Off Topic / Spam / Re: Full Browser!
|
on: March 14, 2012, 11:17:18 am
|
Since this time, a lot of players been on this server, including Svenko, which Wide known on planet Earth and beyond our Solar System as great admin of lolmortuary server.
When the LU team finishes Grand Central Racing in five years, you'll eat those words. * stormeus runs
|
|
|
|