Gotoloc System
Add to onScirptsLoad()
QuerySQL( youdatabase, "CREATE TABLE IF NOT EXISTS teleporty ( Nick VARCHAR(32), Nazwa VARCHAR(32), Loc VARCHAR(32) )" );
This command add teleport
else if ( cmd == "addloc" )
{
if ( stats[ player.ID ].Login )
{
if ( stats[ player.ID ].Level >= 9 )
{
QuerySQL( youdatabase, "INSERT INTO teleporty ( Nick,Nazwa, Loc ) values ( '" + player.Name + "', '" + text + "', '" + player.Pos.x + "," + player.Pos.y + "," + player.Pos.z + "' )");
MessagePlayer( "[#00ff00]You've added locations named " + text + " to database", player );
}
else MessagePlayer( "[#00ff00]You must heve [9] level to use this command. " , player );
}
else MessagePlayer( "[#ffffff][INFO][#00ff00]Please login." , player );
return 1;
}
Command /gotoloc < loc name >
else if ( cmd == "gotoloc" )
{
if ( stats[ player.ID ].Login )
{
if ( text )
{
local q = QuerySQL( youdatabase, "SELECT Nick, Nazwa, Loc FROM teleporty WHERE Nazwa LIKE '%" + text + "%'" );
if ( GetSQLColumnData( q, 2 ) != null )
{
local pos = split( GetSQLColumnData( q, 2 ), "," );
player.Pos = Vector( pos[0].tofloat(), pos[1].tofloat(), pos[2].tofloat() );
MessagePlayer( "[#00ff00]--- > Teleport to the location [ [#ffffff]" + text + "[#00ff00] ] Created by [ [#ffffff]" + GetSQLColumnData( q, 0 ) + "[#00ff00] ]" , player );
}
else MessagePlayer( "[#00ff00]Given location is not in the database", player );
}
else MessagePlayer( "[#00ff00]Enter a location name", player );
}
else MessagePlayer( "[#ffffff][INFO][#FD0F0F] Please login. " , player );
}