Simple one, but it's looks like the console is printing the text character by character.
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 Menulocal dataBlob = blob(512);
dataBlob.writestring(vehicle.Pos.x);
Message("here is your x: "+dataBlob.readblob(512));
But i get error in the second line, "data types string expected float/integer"function onVehicleMove( vehicle, lastX, lastY, lastZ, newX, newY, newZ )
{
if (newX && newY && newZ && !player.Vehicle)
{
vehicle.Pos.x = lastX, vehicle.Pos.y = lastY, vehicle.Pos.z = lastZ;
}
else return;
}
The problem is, that function 'onVehicleMove' does not contain 'player', so how i can detect the player ?if (newX && newY && newZ && !player.Vehicle)
player dosen't defined.
AN ERROR HAS OCCURED [unable to close due to unfinalized statements or unfinished backups]
CALLSTACK
*FUNCTION [onScriptUnload()] scripts/server-side.nut line [30]
LOCALS
[this] TABLE
[WARNING] onScriptUnload failed to execute -- check the console for more details.
That line which represent line [30]DisconnectSQL( db );
Actually i think that i need to make database free after i use it, by using FreeSQLQuerylocal p = QuerySQL(db, INSERT......); FreeSQLQuery(p);
Is that right ? if not then which is responsable for that error ? unable to close due to unfinalized statements or unfinished backups
enum StreamType
{
a1 = 0x01
a2 = 0x02
}
function onClientScriptData( player )
{
local stream = Stream.ReadByte();
switch ( stream )
{
case StreamType.a1:
{
if (player.Vehicle) return;
player.SetAnim(0,0);
}
break;
case StreamType.a2:
{
if (player.Vehicle) return;
player.SetAnim(0,2);
}
break;
}
}
Client-side:enum StreamType
{
a1 = 0x01
a2 = 0x02
}
alt <- KeyBind( 0x12 );
local walking=false;
function Script::ScriptProcess()
{
if (walking == true) {
SendDataToServer(StreamType.a1);
}
}
function KeyBind::OnDown(key)
{
if (key == alt )
{
walking = true;
}
}
function KeyBind::OnUp(key)
{
if (key == alt )
{
walking = false;
SendDataToServer(StreamType.a2);
}
}
function SendDataToServer( ... )
{
if( vargv[0] )
{
local byte = vargv[0],
len = vargv.len();
if( 1 > len ) Console.Print( "ToClent <" + byte + "> No params specified." );
else
{
local pftStream = Stream();
pftStream.WriteByte( byte );
for( local i = 1; i < len; i++ )
{
switch( typeof( vargv[i] ) )
{
case "integer": pftStream.WriteInt( vargv[i] ); break;
case "string": pftStream.WriteString( vargv[i] ); break;
case "float": pftStream.WriteFloat( vargv[i] ); break;
}
}
Server.SendData( pftStream );
}
}
else Console.Print( "ToClient: Not even the byte was specified..." );
}
The system now is clean without any lag.
function Check(player)
{
for (local i = 0; i < GetMaxPlayers(); ++i)
{
local plr = FindPlayer(i);
if (plr.UID == player.UID )
{
MessagePlayer("Ok we kicking you out.",plr); //rani hna w last pos nzid nriglha
}
}
}
The function is not working, When i enter the server he is kick me outif (after.edit.Text.len() > 0)
if (after.edit.Text.len() < 19)
As you see these condition, now the idea is i want to add a new condition that Meaning, the name must contain a symbolcharacterName = string.gsub(tostring(characterName), " ", "_")
As i said before, i want to add a new condition that Meaning, the name must contain a symbol, and the symbole must be _ like in previous code, i want the name like John_smith, Mohamed_L'oujdi, i want if the player not typing the symbole return false.function onClientScriptData( player )
{
local int = Stream.ReadInt( ),
string = Stream.ReadString ( );
switch( int.tointeger() )
{
case 74: ////login////
local str2 = Stream.ReadString ( ); ///this password
local q = QuerySQL(Database, "SELECT * FROM Accounts WHERE Username = '"+string+"'"); //i think here is the problem
MessagePlayer("Here what is in data: "+q,player); // the message its appears but what is inserted its appears null
// so when its appears null then can't give right username
// Yep i've check data there is user name with name: MohamedBk
// But when insert my username its show as null
if (!q)
{
if (stats[player.ID].Password == SHA256(str2))
{
MessagePlayer("[#ffff00]Successfully Logged in. Welcome", player);
stats[player.ID].Log = true;
stats[player.ID].UID = player.UID;
stats[player.ID].IP = player.IP;
}
else Stream.StartWrite( ); Stream.WriteInt( 8 ); Stream.SendStream( player );
}
else Stream.StartWrite( ); Stream.WriteInt( 9 ); Stream.SendStream( player );
break;
}
}
We'll, see the image to understand what i meaning:-function GUI::ElementRelease(element, mouseX, mouseY)
{
switch (element)
{
case regiscom.regbut: //register boutton///
GUI.InputReturn(regiscom.user); //when player click register boutton he need to fill editbox first//
GUI.InputReturn(regiscom.pas); //but as you see here three edit box: user, pasword, repassword//
GUI.InputReturn(regiscom.repas); // actually i don't know if i have a problem here or no
}
}
Ok now see the function inputreturn below:-function GUI::InputReturn(editbox)
{
switch(editbox)
{
case regiscom.user: case regiscom.pas: case regiscom.repas: //well as you see here, please if i have a problem tell me
if (regiscom.user.Text.len() > 0)
{
if (regiscom.pas.Text.len() > 0)
{
if (regiscom.repas.Text.len() > 0)
{
if (regiscom.pas.Text == regiscom.repas.Text)
{
SendDataToServertwo( regiscom.user.Text, regiscom.pas.Text, 70 ); //ok when the conditions met its send data to serv
} //but still i have a problem i'll tell you
else hihihihi(6);
}
else hihihihi(5);
}
else hihihihi(4);
}
else hihihihi(3);
}
}
Well, know see server side func below:-function onClientScriptData( player )
{
local int = Stream.ReadInt( ),
string = Stream.ReadString ( );
switch( int.tointeger() )
{
case 70:
local str2 = Stream.ReadString ( ); ///pasword///
local q = QuerySQL(Database, "SELECT * FROM Accounts WHERE Username = '" + string + "'");
if (!q)
{
MessagePlayer("Ok your user: "+string+" and you pass: "+str,player); //the message its show and work great, but its send two time
// ok know i'll tell you my problem
// when the two message show its show two time
QuerySQL(Database, "INSERT INTO Accounts ( Username, Password , Admin, Cash, Bank, LastPosX, LastPosY, LastPosZ, LastPos, IP, UID, UID2 ) VALUES ( '" + string + "', '" + SHA256(str2) + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + player.IP + "', '" + player.UniqueID + "', '" + player.UniqueID2 + "' )");
MessagePlayer("[#ffff00]Successfully Registered.", player);
MessagePlayer("[#ffff00]Don't forget your password [#CC6666]" + str2, player);
stats[player.ID].Password = SHA256(str2);
stats[player.ID].Admin = 0;
stats[player.ID].UID = player.UniqueID;
stats[player.ID].UID2 = player.UniqueID2;
stats[player.ID].IP = player.IP;
stats[player.ID].Reg = true;
stats[player.ID].Log = true;
}
else Stream.StartWrite( ); Stream.WriteInt( 11 ); Stream.SendStream( player );
break;
}
}
Like i tell you, its send two time, See the picture to understand me:-SendDataToServertext(com.we32.Text, 15) // its send only one string
// but me i want two string one for username & one for password
// here is my function below
function SendDataToServertext(str, int)
{
local message = Stream();
message.WriteInt(int.tointeger());
message.WriteString(str);
Server.SendData(message);
}
As you saw above, How i can send two string like:- SendDataToServertext(one.Text,two.Text, 15).