For future reference, you can always find the latest version mirrored here: http://u04.thijn.ovh/
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: KingOfVC on May 18, 2017, 05:58 PMExample code:You forgot to actually take some money of the player.function onPlayerCommand( player, cmd, text )
{
if( cmd == "heal" )
{
if( player.Health > 99 ) MessagePlayer( "You no need be healed. ", player );
else if( player.Cash < 100 ) MessagePlayer( "You need $100 to heal!", player );
else
{
player.Health = 100;
MessagePlayer( "Healed.", player );
}
}
}
Quote from: KAKAN on May 04, 2017, 02:01 PMoh man, can't you really understand that thing? That's just what he doesn't want.Then you didn't understand his code. A callback function is fired when the separate thread where the request is being done is finished, so there will be no blocking.
Squirrel is synchronous in nature, if that code is executed, then every player will lag until the data is received.
So, its doing something like this:player-on-chat:
That condition will stay true until the data is received.
while(true){};
Now suppose, its for 5 seconds, then that message would appear after 5 seconds, and during that 5 seconds, chat or heck the players won't be synced because the server is busy in doing something else.
Quote from: KAKAN on Apr 28, 2017, 02:08 AMThat is not a valid query.Quote from: kennedyarz on Apr 27, 2017, 06:06 PMNot recommended as it confuses the newbie, it is better to do it separate and will see more if he has an error.local pPos = player.Pos;
Okay now?
local query = format("UPDATE Vehicles( PX, PY, PZ, Angle ) VALUES( %f, %f, %f, %f ) WHERE ID=%i",
pPos.x,
pPos.y,
pPos.z,
player.Angle,
v.ID
);
QuerySQL( db, query );
Quote from: kennedyarz on Apr 27, 2017, 06:06 PMAnd then they are confused because their server lags. Nah. It's better to teach them correctly, and just explain what's happening instead of learning them the wrong way.Quote from: Xmair on Apr 27, 2017, 04:20 PMQuote from: kennedyarz on Apr 27, 2017, 12:42 PMUse this method, so there will be no need to restart the server so that the vehicle appears where I put itQuerySQL( db,"UPDATE Vehicles SET PX='"+player.Pos.x+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET PY='"+player.Pos.y+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET PZ='"+player.Pos.z+"' WHERE ID='"+v.ID+"'");
QuerySQL( db,"UPDATE Vehicles SET Angle='"+player.Angle+"' WHERE ID='"+v.ID+"'");QuerySQL( db, "UPDATE Vehicles SET PX = '" + player.Pos.x + "', PY = '" + player.Pos.y + "', PZ = '" + player.Pos.z + "', Angle = '" + player.Angle + "' WHERE ID = " + v.ID );
Not recommended as it confuses the newbie, it is better to do it separate and will see more if he has an error.
Quote from: aXXo on Apr 20, 2017, 05:53 PMwith a programming teacher who added Squirrel Scripting as the curriculum for little kids.If that is the case, I really hope education in Pakistan is not as fucked up that it teaches people such a low level of understanding of any scripting language as people on this forum.
Quote from: QW.jester on Apr 07, 2017, 06:31 AMMake your own topic.
Help me pls