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 MenuCreateObject( 371, player.UniqueWorld, player.Pos.x, player.Pos.y, player.Pos.z, 255 );
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" );
}
}
}
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;
}
}
}
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;
}
function onScriptLoad()
{
print(">>> System SubBan loaded <<<");
db <- ConnectSQL( "DataBase.db" );
QuerySQL( db, "CREATE TABLE IF NOT EXISTS SubBans ( Name VARCHAR(32), IP VARCHAR(25), Admin TEXT, Reason TEXT )" );
}
function onScriptUnload()
{
DisconnectSQL( db );
}
function onPlayerJoin( player )
{
NewTimer( "CheckBan", 1000, 1, player.ID );
}
function CheckBan( user )
{
local player = FindPlayer( user );
if ( player )
{
local ip = player.IP;
local sub = split( ip, "." );
local q = QuerySQL( db, "SELECT * FROM SubBans WHERE IP='" + sub[0].tofloat() + "." + sub[1].tofloat() + "'" );
if ( GetSQLColumnData( q, 0 ) )
{
Message( ">>> " + player + " Banned From Server <<<");
KickPlayer( player );
return 1;
}
}
}
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "ban" )
{
if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <Nick/ID> <Reason>", player );
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "[Error] - Unknown Player..", player );
else {
local reason = GetTok( text, " ", 2 NumTok( text, " " ) );
local ip = plr.IP;
local sub = split( ip, "." );
if ( reason == null ) reason = "None";
QuerySQL( db, "INSERT INTO SubBans ( Name, IP, Admin, Reason ) VALUES ( '" + plr.Name + "', '" + sub[0].tofloat() + "." + sub[1].tofloat() + "', '" + player.Name + "', '" + reason + "' )" );
Message( "[#EE82EE]** Admin " + player.Name + " Banned " + plr.Name + " Reason: " + reason );
KickPlayer( plr );
}
}
}
else if ( cmd == "unban" )
{
local q = QuerySQL( db, "SELECT * FROM SubBans WHERE Name='" + text + "'" );
if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <Nick Full>", player );
else if ( GetSQLColumnData( q, 0 ) != text ) MessagePlayer( "[Error] - " + text + " is not Banned.", player );
else {
QuerySQL( db, "DELETE FROM SubBans WHERE Name='" + text + "'" );
Message( "[#EE82EE]** Admin " + player.Name + " UnBanned Player [ [#FFA500]" + text + " [#EE82EE]]." );
}
}
}
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 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 NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}
function onPlayerSpawn( player )
{
Safe <- NewTimer( "CheckSafe", 3000, 0, player.ID );
}
function CheckSafe( user )
{
local player = FindPlayer( user );
if ( player )
{
local EnterSafe = DistanceFromPoint( player.Pos.x, player.Pos.z, -937.731, 17.8038 );
local ExitSafe = DistanceFromPoint( player.Pos.x, player.Pos.z, -937.698, 7.22692 );
if ( EnterSafe.tointeger() < 1 )
{
NewTimer( "ResetFffect", 500, 1, player.ID );
player.Pos = Vector( -937.698, -351.819, 7.22692 );
player.Widescreen = true;
}
else if ( ExitSafe.tointeger() < 1 )
{
NewTimer( "ResetFffect", 500, 1, player.ID );
player.Pos = Vector( -937.731, -351.445, 17.8038 );
player.Widescreen = true;
}
}
}
function ResetFffect( user )
{
local player = FindPlayer( user );
if ( player )
{
player.Widescreen = false;
}
}
function onPlayerTeamKill( killer, player ,reason, bodypart )
{
Safe.Delete();
}
function onPlayerKill( killer,player, reason, bodypart )
{
Safe.Delete();
}
function onPlayerDeath( player, reason )
{
Safe.Delete();
}