Show Posts

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.

Topics - Diego^
4
Bugs and Crashes / [BUG] Object in UniqueWorld for a Player
« on August 7th, 2016, 07:57 PM »
I created an object to a player, using:
Code: [Select]
CreateObject( 371, player.UniqueWorld, player.Pos.x, player.Pos.y, player.Pos.z, 255 );


https://youtu.be/6OIv02fxlA4

But when the player is on the object, the player disappears to the other players. This is a bug?


Sorry for my bad English.
5
Videos & Screenshots / [BRL] Soccer updated
« on February 22nd, 2016, 12:54 AM »
6
Snippet Showroom / Alias System - IP/SUBNET/UID
« on December 12th, 2015, 10:19 PM »
Code: [Select]
function onScriptLoad()
{
Alias <- [];
adb <- ConnectSQL( "Alias.db" );
QuerySQL( adb , "CREATE TABLE IF NOT EXISTS Alias ( Name TEXT, IP VARCHAR(20), UID TEXT )" );
LoadAlias();
}

function onScriptUnload()
{
DisconnectSQL( adb );
}

function LoadAlias()
{
local q = QuerySQL( adb, "SELECT * FROM Alias" ), i = 0;
while ( GetSQLColumnData( q, 0 ) != null )
{
Alias.push( { Nick = GetSQLColumnData( q, 0 ), IP = GetSQLColumnData( q, 1 ), UID = GetSQLColumnData( q, 2 ) } );
i ++;
GetSQLNextRow( q );
}
FreeSQLQuery( q );
print( "[Loaded] Alias - " + i );
}

function onPlayerJoin( player )
{
AddAlias( player );
}

function AddAlias( player )
{
local q = QuerySQL( adb,  "SELECT * FROM Alias WHERE Name='" + player.Name + "'" );
if ( !GetSQLColumnData( q, 0 ) )
{
QuerySQL( adb, "INSERT INTO Alias ( Name, IP, UID ) VALUES ( '" + player.Name + "', '" + player.IP + "', '" + player.UniqueID + "' )" );
Alias.push( { Nick = player.Name, IP = player.IP, UID = player.UniqueID } );
}
else
{
if ( GetSQLColumnData( q, 1 ) != player.IP )
{
QuerySQL( adb, "UPDATE Alias SET IP='" + player.IP + "' WHERE Name='" + player.Name + "'" );
UpdateAlias( player, "ip" );
}
if ( GetSQLColumnData( q, 2 ) != player.UniqueID )
{
QuerySQL( adb, "UPDATE Alias SET UID='" + player.UniqueID + "' WHERE Name='" + player.Name + "'" );
UpdateAlias( player, "uid" );
}
}
}

function UpdateAlias( player, option )
{
for ( local i = 0; i < Alias.len(); i++ )
{
if ( Alias[i].Nick == player.Name )
{
if ( option == "ip" ) Alias[i].IP = player.IP;
if ( option == "uid" ) Alias[i].UID = player.UniqueID;
}
}
}

function ShowAlias( player, plr, option )
{
if ( option == "ip" )
{
local i = 0, a = Alias.len(), b;
while( i < a )
{
if ( plr.IP == Alias[i].IP && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) MessagePlayer( plr.Name + " has no IP alias.", player );
else MessagePlayer( plr.Name + "'s IP alias: " + b + ".", player );
}
else if ( option == "subnet" )
{
local i = 0, a = Alias.len(), b;
local getsub_1 = split( player.IP, "." ),
sub_1 = getsub_1[0] + getsub_1[1];
while( i < a )
{
local getsub_2 = split( Alias[i].IP, "." ),
sub_2 = getsub_2[0] + getsub_2[1];
if ( sub_1 == sub_2 && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) MessagePlayer( plr.Name + " has no Subnet alias.", player );
else MessagePlayer( plr.Name + "'s Subnet alias: " + b + ".", player );
}
else if ( option == "uid" )
{
local i = 0, a = Alias.len(), b;
while( i < a )
{
if ( plr.UniqueID == Alias[i].UID && plr.Name != Alias[i].Nick )
{
if ( b ) b = b + ", " + Alias[i].Nick;
else b = Alias[i].Nick;
}
i ++;
}
if ( !b ) MessagePlayer( plr.Name + " has no UID alias.", player );
else MessagePlayer( plr.Name + "'s UID alias: " + b + ".", player );
}
}

function GetPlayer( plr )
{
if ( plr )
{
if ( IsNum( plr ) )
{
plr = FindPlayer( plr.tointeger() );
if ( plr ) return plr;
else return false;
}
else
{
plr = FindPlayer( plr );
if ( plr ) return plr;
else return false;
}
}
else return false;
}

function onPlayerCommand( player, cmd, text )
{
if ( cmd == "ipalias" )
{
if ( !text ) MessagePlayer( "Syntax: /" + cmd + " <Nick/ID>", player );
else
{
local plr = GetPlayer( text );
if ( !plr ) MessagePlayer( "Unknown Player.", player );
else ShowAlias( player, plr, "ip" );
}
}

else if ( cmd == "subnetalias" )
{
if ( !text ) MessagePlayer( "Syntax: /" + cmd + " <Nick/ID>", player );
else
{
local plr = GetPlayer( text );
if ( !plr ) MessagePlayer( "Unknown Player.", player );
else ShowAlias( player, plr, "subnet" );
}
}

else if ( cmd == "uidalias" )
{
if ( !text ) MessagePlayer( "Syntax: /"+ cmd + " <Nick/ID>", player );
else
{
local plr = GetPlayer( text );
if ( !plr ) MessagePlayer( "Unknown Player.", player );
else ShowAlias( player, plr, "uid" );
}
}
}

Commands: (/)ipalias, subnetalias, uidalias.
9
Closed Bug Reports / Blocking Shots
« on August 27th, 2015, 08:22 PM »
I was playing with my Brazilian friends, and discovering this bug:


https://www.youtube.com/watch?v=zYuRpj8CjtQ&feature=youtu.be
11
Snippet Showroom / Object System
« on July 27th, 2015, 12:36 AM »
Object System

With this simple system, you will be able to create objects in real time on your server and saved it.

Code: [Select]
function onScriptLoad()
{
db <- ConnectSQL( "DataBase.db" );
print("Object System Started...");
ObjTime <- false;
QuerySQL(db, "CREATE TABLE IF NOT EXISTS Objects ( ID NUMERIC, Model NUMERIC, PX FLOAT, PY FLOAT, PZ FLOAT, AX FLOAT, AY FLOAT, AZ FLOAT )" );
LoadObjects();
}

function onScriptUnload()
{
DisconnectSQL( db );
}

function LoadObjects()
{
try {
if ( CountObjects() != 0 )
{
    local q = QuerySQL( db, "SELECT * FROM Objects WHERE ID LIKE '%'" ), pos;
    while( GetSQLColumnData( q, 0 ) )
    {
        local model = GetSQLColumnData( q, 1 ),
        px = GetSQLColumnData( q, 2 ).tofloat(),
        py = GetSQLColumnData( q, 3 ).tofloat(),
        pz = GetSQLColumnData( q, 4 ).tofloat(),
        ax = GetSQLColumnData( q, 5 ).tofloat(),
                ay = GetSQLColumnData( q, 6 ).tofloat(),
        az = GetSQLColumnData( q, 7 ).tofloat();
           CreateObject( model, 0, Vector( px, py, pz ), 255 ).RotateToEuler( Vector( ax, ay, az ), 0 );
   GetSQLNextRow( q );
     }
        FreeSQLQuery( q );
        print( "Loaded objects: "+ CountObjects() );
 }
}
catch(e) print( "[Error] LoadObjects - " + e );
}

function CountObjects()
{
try
{
        local a = 0, q = QuerySQL( db, "SELECT * FROM Objects" );
        while ( GetSQLColumnData( q, 0 ) )
        {
                a ++;
                GetSQLNextRow( q );
        }
        return a;
FreeSQLQuery( q );
}
catch(e) print( "[Error] CountObjects - " + e );
}

function GetTok(string, separator, n, ...)
{
 local m = vargv.len() > 0 ? vargv[0] : n,
    tokenized = split(string, separator),
    text = "";

 if (n > tokenized.len() || n < 1) return null;
 for (; n <= m; n++)
 {
  text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
 }
 return text;
}

function onPlayerCommand( player, cmd, text )
{
      if ( cmd == "obj" )
{
     if ( !text ) MessagePlayer( "[Sintaxe] - /" + cmd + " <ID>", player );
else if ( ObjTime == true ) MessagePlayer( "[Error] - An object is created, use /objdel or /objsave.", player );
else
{
   OBJ <- CreateObject( text.tointeger(), player.World, Vector( player.Pos.x, player.Pos.y, player.Pos.z + 0.5 ), 255 );
           MessagePlayer( "Created Object...", player );
           ObjTime = true;
   }
}

else if ( cmd == "objmov" )
{
     if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <x/y/z> <+/-> <value>", player );
   else {
local pos = GetTok( text, " ", 1);
if ( !pos ) MessagePlayer( "[Syntax] - /" + cmd + " <x/y/z> <+/-> <value>", player );
else if (pos != "x" && pos != "y" && pos != "z") MessagePlayer("[Error] - x/y/z.",player);
else
{
local sign = GetTok( text, " ", 2);
   if (!sign) MessagePlayer("[Error] - Use sign +/-.",player);
   else if (sign != "+" && sign != "-") MessagePlayer("[Error] - Use sign +/-.",player);
   else
   {
   local value = GetTok( text, " ", 3);
   if (!value) MessagePlayer( "[Syntax] - /" + cmd + " <x/y/z> <+/-> <value>", player );
   else
   {
   if (pos == "x")
   {
   if (sign == "-")
{
OBJ.MoveTo( Vector( OBJ.Pos.x - value.tofloat(), OBJ.Pos.y, OBJ.Pos.z ), 2800 );
    MessagePlayer( "Object Moved...", player );
}
   if (sign == "+")
   {
   OBJ.MoveTo( Vector( OBJ.Pos.x + value.tofloat(), OBJ.Pos.y, OBJ.Pos.z ), 2800 );
    MessagePlayer( "Object Moved...", player );
           }
           }
            if (pos == "y")
   {
   if (sign == "-")
{
OBJ.MoveTo( Vector( OBJ.Pos.x, OBJ.Pos.y - value.tofloat(), OBJ.Pos.z ), 2800 );
    MessagePlayer( "Object Moved...", player );
}
   if (sign == "+")
   {
   OBJ.MoveTo( Vector( OBJ.Pos.x, OBJ.Pos.y + value.tofloat(), OBJ.Pos.z ), 2800 );
    MessagePlayer( "Object Moved...", player );
           }
           }
           if (pos == "z")
   {
   if (sign == "-")
{
OBJ.MoveTo( Vector( OBJ.Pos.x, OBJ.Pos.y, OBJ.Pos.z - value.tofloat() ), 2800 );
    MessagePlayer( "Object Moved...", player );
}
   if (sign == "+")
   {
   OBJ.MoveTo( Vector( OBJ.Pos.x, OBJ.Pos.y, OBJ.Pos.z + value.tofloat() ), 2800 );
    MessagePlayer( "Object Moved...", player );
           }
           }
   }
   }
  }
}
}

else if ( cmd == "objrot" )
{
     if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <x/y/z> <+/-> <value>", player );
   else {
local pos = GetTok( text, " ", 1);
if ( !pos ) MessagePlayer( "[Syntax] - /" + cmd + " <x/y/z> <+/-> <value>", player );
else if (pos != "x" && pos != "y" && pos != "z") MessagePlayer("[Error] - x/y/z.",player);
else
{
local sign = GetTok( text, " ", 2);
   if (!sign) MessagePlayer("[Error] - Use sign +/-.",player);
   else if (sign != "+" && sign != "-") MessagePlayer("[Error] - Use sign +/-.",player);
   else
   {
   local value = GetTok( text, " ", 3);
   if (!value) MessagePlayer( "[Syntax] - /" + cmd + " <x/y/z> <+/-> <value>", player );
   else
   {
   if (pos == "x")
   {
   if (sign == "-")
{
OBJ.RotateToEuler( Vector( OBJ.RotationEuler.x - value.tofloat(), OBJ.RotationEuler.y, OBJ.RotationEuler.z ), 2800 );
    MessagePlayer( "Rotated Object...", player );
}
   if (sign == "+")
   {
   OBJ.RotateToEuler( Vector( OBJ.RotationEuler.x + value.tofloat(), OBJ.RotationEuler.y, OBJ.RotationEuler.z ), 2800 );
    MessagePlayer( "Rotated Object...", player );
           }
           }
            if (pos == "y")
   {
   if (sign == "-")
{
OBJ.RotateToEuler( Vector( OBJ.RotationEuler.x, OBJ.RotationEuler.y - value.tofloat(), OBJ.RotationEuler.z ), 2800 );
    MessagePlayer( "Rotated Object...", player );
}
   if (sign == "+")
   {
   OBJ.RotateToEuler( Vector( OBJ.RotationEuler.x, OBJ.RotationEuler.y + value.tofloat(), OBJ.RotationEuler.z ), 2800 );
    MessagePlayer( "Rotated Object...", player );
           }
           }
           if (pos == "z")
   {
   if (sign == "-")
{
OBJ.RotateToEuler( Vector( OBJ.RotationEuler.x, OBJ.RotationEuler.y, OBJ.RotationEuler.z - value.tofloat() ), 2800 );
    MessagePlayer( "Rotated Object...", player );
}
   if (sign == "+")
   {
   OBJ.RotateToEuler( Vector( OBJ.RotationEuler.x, OBJ.RotationEuler.y, OBJ.RotationEuler.z + value.tofloat() ), 2800 );
    MessagePlayer( "Rotated Object...", player );
           }
           }
   }
   }
  }
}
}

else if ( cmd == "objsave" )
{
if ( ObjTime == false ) MessagePlayer( "[Error] - There created objects.", player );
else {
       local id = CountObjects()+1;
                QuerySQL( db, "INSERT INTO Objects ( ID, Model, PX, PY, PZ, AX, AY, AZ ) VALUES ( '" + id + "', '" + OBJ.Model + "', '" + OBJ.Pos.x + "', '" + OBJ.Pos.y + "', '" + OBJ.Pos.z + "', '" + OBJ.RotationEuler.x + "', '" + OBJ.RotationEuler.y + "', '" + OBJ.RotationEuler.z + "'  )" );
        ObjTime = false;
        MessagePlayer( "Object Saved...", player );
}
}

else if ( cmd == "objdel" )
  {
   if ( ObjTime == false ) MessagePlayer( "[Error] - There created objects.", player );
  else {
  OBJ.Delete();
  MessagePlayer( "Object Deleted...", player );
  ObjTime = false;
  }
  }
}
12
Closed Bug Reports / CreateSphere error in Windows
« on June 21st, 2015, 12:33 AM »
When the new function was released CreateSphere I tested it on my windows and it worked perfectly, now I need to use and does not work anymore, I'm using the example of wiki:
(click to show/hide)
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "test" )
       {
       CreateSphere( player, 1, player.Pos, RGB(255, 0, 255), 2);
       }
}

Shows the following error:


Note: In Linux it works perfectly, but I create in my windows and then send to the host.
13
General Discussion / Stop a Helicopter
« on June 17th, 2015, 03:06 PM »
Well I created a fuel system, I realized that Vehicle.Kill function is not the same as 0.3, which would stop any vehicle, so I used The function SetHandlingData and could cause the vehicle to stop, the more I realized that the helicopter did not stop, then I would that someone would help me.

 ???
14
General Discussion / [HELP] Some sound ID bugged
« on June 3rd, 2015, 10:28 PM »
Once started the 0.4, I tested various sounds ID and all worked, but now I try again and realized that most are not working. I had tested at the beginning of the "SWAT". Can anyone help me?

Sorry for my bad english!
15
Snippet Showroom / One way to be healed
« on May 12th, 2015, 09:00 PM »
Code: [Select]
function onScriptLoad()
{
H <- BindKey(true,0x48,0,0);
Heal <- array( GetMaxPlayers(), false );
NewTimer("Key_Pressing" , 1000, 0 );
}
function onKeyDown( player, bindid )
{
        switch(bindid)
        {
        case H:
                if ( player.IsSpawned && player.Health < 100 )
            {
                    Heal[ player.ID ] = true;
                    MessagePlayer("To be healed totally not release the H button...", player );
                    }
        break;
        }
}
function onKeyUp( player, bindid )
{
switch(bindid)
        {
       case H:
       Heal[ player.ID ] = false;
       if( player.Health < 100 ) MessagePlayer("INFO: You must hold to be fully healed.", player );
       break;
        }
}
function Key_Pressing()
{
if ( GetPlayers() >= 1 )
{
        for ( local i = 0; i < GetMaxPlayers(); i++ )
        {
                local player = FindPlayer( i );
                if ( player )
                {
                        if ( player.IsSpawned )
                        {
                  if ( Heal[ player.ID ] == true )
                  {
                  if ( player.Health == 100 ) 
                 {
                 Heal[ player.ID ] = false;
                 MessagePlayer("You were completely healed!", player );
                 }
                 else player.Health ++; //You can edit!
                  }
}
}
}
}
}
function onPlayerPart( player, reason )
{
if ( Heal[ player.ID ] == true ) Heal[ player.ID ] = false;
}