Menu

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.

Show posts Menu

Messages - :P

#31
Off-Topic General / what is
Oct 14, 2015, 04:49 PM
whatis custom messages as here says
Quote from: Siezer on Sep 27, 2015, 02:15 PMScript updates - Starfish DM v.2
  • A custom message for kills and deaths.
#32
i try but its giving error calling to array
#33
what can i use for giving back weps to a player for example i disarm a player give him 1 wep in case of like !fight when he exit how i can give him weps back
#34
Quote from: Kusanagi on Oct 08, 2015, 05:00 PMThat error is in onPlayerPart in last line status[player.ID] = null;


I know because i already had that problem few months ago
how you solve it
#35
not works
#36
Scripting and Server Management / Re: price
Oct 09, 2015, 02:49 PM
which cmds i post how is its good my first time try to make
And thanx For cmds
#37
Scripting and Server Management / Re: price
Oct 09, 2015, 01:44 PM
AND PLEASE FIX MY CMDS SOON
#38
Scripting and Server Management / Re: price
Oct 09, 2015, 01:41 PM
#39
Scripting and Server Management / Re: price
Oct 09, 2015, 09:05 AM
in the table is cost
#40
Scripting and Server Management / Re: price
Oct 09, 2015, 09:02 AM
this is but not works cost does not exists i try with price but dont work   else if ( cmd == "setcarprice" )
    {
if ( IsNoob( player, cmd ) ) return 0;
          else if ( !text ) MessagePlayer("Error, [Syntax] setcarprice <car id> <newprice>", player ); 
        {
                local id = GetTok( text, " ", 1 ), newcost = GetTok ( text, " ", 2);
                if ( !IsNum( id ) ) MessagePlayer("Error, [Syntax] invalid car id", player );
                else
                {
                                       if ( !IsNum( newcost ) ) MessagePlayer("Error, [Syntax] the number must be in numbers", player );
                                       else
                                       {
                                                id = id.tointeger();
                                                newcost = newcost.tointeger();
                                                local setnewcost = format( "UPDATE cars SET Price=%i WHERE carID=" + id, newcost );
                                                if ( carcost( id ) == 0 )
                                                {
                                                        ::QuerySQL( DB, "REPLACE INTO cars (carID) VALUES (" + id + ")" );
                                                } 
                                                EMessage( "** Price Changed - car ID: " + id + " - Name: " + Findcar( id ) + " - New cost: $" + Bytes( newcost ) );
                                                QuerySQL( DB, setnewcost );
                                        }
                }     
        }
    }
#41
Scripting and Server Management / price
Oct 09, 2015, 08:22 AM
Is it Possible to set Vehicle price from cmds If yes then how
#42
Scripting and Server Management / tempban
Oct 08, 2015, 01:54 PM
i trying to add tempban but getting error player does not exists here is many lines in functions i get error in main.nut line 137 its timer
here is function
/*
        [RBG] Rocky's Temp-Ban system (v0.1)
This is completly made by me,
You are free to use, modify it for your own use.
Put my name on credits list only if you like my work.
*/
//Events ->
function onScriptLoad()
{
     LoadModule( "sq_lite" );
database <- ConnectSQL( "Data.sqlite" );
     QuerySQL( database, "CREATE TABLE IF NOT EXISTS Banned( ban_nick TEXT, ban_ip TEXT, ban_time TEXT, ban_expire TEXT, ban_expireratio TEXT, ban_admin TEXT, ban_reason TEXT )" );
print("[RBAN] Rocky's Ban system Loaded (v0.1)");
}        

function onPlayerCommand( player, cmd, text )
{
     cmd = cmd.tolower();
     if ( cmd == "tempban" )
     {
      local txt_Split;
          if( !player.IsAdmin ) PrivMessage("[RBAN] You are not a admin.", player );
          else if( !text ) PrivMessage("[RBAN] /c tempban <player> <day:hour:min> <reason>", player);
          else
          {
                if( NumTok( text, " " ) == 2 )
{
     txt_Split = split( text, " " );
local plr = FindPlayer( txt_Split[ 0 ] ), expire = txt_Split[ 1 ];
if( plr ) AddBan( player, plr, expire );
else PrivMessage("[RBAN] No such player.", player );
}
else if( NumTok( text, " " ) >= 3 )
         {
                                           txt_Split = split( text, " " );
                                           local plr = FindPlayer( txt_Split[ 0 ] ), expire = txt_Split[ 1 ], reason = GetTok( text, " ", 3, NumTok( text, " " ) );
if( plr ) AddBan( player, plr, expire, reason );
else PrivMessage("[RBAN] No such player.", player );
}
else PrivMessage("[RBAN] /c tempban <player> <day:hour:min> <reason>", player);
  }
     }
else if( cmd == "untempban" )
{
if( !player.IsAdmin ) PrivMessage("[RBAN] You are not a admin.", player );
else if( !text ) PrivMessage("[RBAN] /c untempban <Fullname>", player);
else if( !IsBanned( text ) ) PrivMessage("[RBAN]Player is not banned.", player);
else
{
        QuerySQL( database, "DELETE TABLE FROM Banned WHERE ban_nick='" + text + "' COLLATE NOCASE" );
Message("Unbanned: [ " + text + " ] by Admin: [ " + player.Name + " ]" );
}
}
}

function onPlayerJoin( player )
{
     NewTimer( "Banned", 3000, 1,  player ); //Check if player is banned.
}

//Functions ->
//Everyone is familiar with this function. :P
function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}
//This basically stores the ban info into database reason for ban is optional.
function AddBan( admin, player, expire, reason = "Not Specified" )
{
     //Equation = (DAYS*24*60*60) + (HOUR*60*60) + (MIN*60)
     local ban_Expire = split( expire, ":" ); //days:hours:minutes
if( NumTok( expire, ":" ) == 3 )
{
if( IsNum( ban_Expire[ 0 ] ) &&  IsNum( ban_Expire[ 1 ] ) && IsNum( ban_Expire[ 2 ] ) )
{
         if( ban_Expire[ 0 ].tointeger() <= 31 && ban_Expire[ 1 ].tointeger() <= 24 && ban_Expire[ 2 ].tointeger() <= 60 )
{
        local ban_Expires = ( (ban_Expire[ 0 ].tointeger()*24*60*60) + (ban_Expire[ 1 ].tointeger()*60*60) + (ban_Expire[ 2 ].tointeger()*60) ), 
                    Calc = ban_Expire[ 0 ] + " Day(s), " + ban_Expire[ 1 ] + " Hour(s), " + ban_Expire[ 2 ] + " Minute(s).",
                    query = QuerySQL( database, "INSERT INTO Banned( ban_nick, ban_ip, ban_time, ban_expire, ban_expireratio, ban_admin, ban_reason ) VALUES ( '"+ player.Name.tostring() +"','"+ player.IP.tostring() +"','"+ time().tostring() +"', '"+ ban_Expires.tostring() +"', '" + expire.tostring() + "', '"+ admin.Name.tostring() +"', '"+ reason.tostring() +"')");
FreeSQLQuery( query );
PrivMessage("[RBAN] You have been temporarily banned by " + admin.Name, player);
PrivMessage("[RBAN] Your ban is set to expire in: " + Calc, player);
KickPlayer( player );
}
}
else PrivMessage("[RBAN] Time should be numeric (day:hour:min)", admin );
}
else PrivMessage("[RBAN] Wrong format, day:hour:min (Numeric)", admin );
}
//Check if player is banned and Kick him/her.
function Banned( player )
{
      local query = QuerySQL( database, "SELECT * FROM Banned WHERE ban_nick='" + player.Name + "' COLLATE NOCASE" ), Ip = player.IP.tostring();
  if( GetSQLColumnData( query, 0 )  )
  {
        if( ( time() - GetSQLColumnData( query, 2 ).tointeger() ) >= GetSQLColumnData( query, 3 ).tointeger() )
{
    local query2 = QuerySQL( database, "DELETE FROM Banned WHERE ban_nick='" + player.Name.tostring() + "'" );
FreeSQLQuery( query2 );
    PrivMessage("[RBAN] Your ban has been expired.", player );
PrivMessage("[RBAN] Stick to the rules or you will get permanently banned.", player );
}
else
{
     local Time_Left = TimeRem( GetSQLColumnData( query, 2 ).tointeger(), GetSQLColumnData( query, 4 ) );
     //local splitban = split(  GetSQLColumnData( query, 4 ), ":"  ), Calc = splitban[ 0 ] + " Day(s), " + splitban[ 1 ] + " Hour(s), " + splitban[ 2 ] + " Minute(s).";
     PrivMessage("[RBAN] Your ban has not expired.", player );
PrivMessage("[RBAN] Your ban is set to expire in. " + Time_Left, player );
KickPlayer( player );
}
  }
  else if( GetSQLColumnData( QuerySQL( database, "SELECT * FROM Banned WHERE ban_ip='" + Ip + "'" ), 0 ) )
  {
        local query = QuerySQL( database, "SELECT * FROM Banned WHERE ban_ip='" + Ip + "'" );
        if( ( time() - GetSQLColumnData( query, 2 ).tointeger() ) >= GetSQLColumnData( query, 3 ).tointeger() )
{
    local query2 = QuerySQL( database, "DELETE FROM Banned WHERE ban_ip='" + player.IP.tostring() + "'" );
FreeSQLQuery( query2 );
    PrivMessage("[RBAN] Your ban has been expired.", player );
PrivMessage("[RBAN] Stick to the rules or you will get permanently banned.", player );
}
else
{
     local Time_Left = TimeRem( GetSQLColumnData( query, 2 ).tointeger(), GetSQLColumnData( query, 4 ).tostring() );
     //local splitban = split(  GetSQLColumnData( query, 4 ), ":"  ), Calc = splitban[ 0 ] + " Day(s), " + splitban[ 1 ] + " Hour(s), " + splitban[ 2 ] + " Minute(s).";
     PrivMessage("[RBAN] Your ban has not expired.", player );
PrivMessage("[RBAN] Your ban is set to expire in. " + Time_Left , player );
KickPlayer( player );
}
  }
  FreeSQLQuery( query );
}

//GeTok function
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;
}

//Check is player is banned.
function IsBanned( fullname )
{
      local query = QuerySQL( database, "SELECT ban_ip FROM Banned WHERE ban_nick='" + fullname + "' COLLATE NOCASE" );
  if( GetSQLColumnData( query, 0 )  ) return true;
  return false;
}

//This returns the time left for ban in Day:hour:minute format.
function TimeRem( bantime,  banratio )
{
        local ban_current = time()-bantime, sp = split(banratio,":"), ban_Days, ban_Hours, ban_Minutes,
ban_Day = sp[ 0 ].tointeger(),
ban_Hour = sp[ 1 ].tointeger(),
ban_Minute = sp[ 2 ].tointeger();
ban_Days = ban_current/86400;
ban_current = ban_current%86400;
ban_Hours = ban_current/3600;
ban_current = ban_current%3600;
ban_Minutes = ban_current/60;
ban_current = ban_current%60;
ban_Day -= ban_Days;
ban_Hour -= ban_Hours;
ban_Minute -= ban_Minutes;
return ban_Day + " Day(s), " + ban_Hour + " Hour(s), " + ban_Minute + " Minutes.";
}

/*
  ~End of the code~
*/
#43
no line was specified only OnPlayerCommand  Player trying to set null
#44
error player trying to set null
#45
Same Error but why