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.

Messages - DarkRaZoR^
1
Scripting and Server Management / Re: fpv diable command
« on February 24th, 10:23 PM »
Try freezing/unfreezing the player or changing his skin. Afaik, altering the skin resets the pedestrian's animation.
2
Servers / [0.4] Re: Arbiter's Official Server
« on August 25th, 2020, 10:21 PM »
I heard rumors that this server leaks account passwords from their echo.
3
Scripting and Server Management / Re: strange problem and solution
« on February 24th, 2020, 05:01 PM »
Quote from habi on February 24th, 2020, 04:36 PM
what is Rotation.w? when i tested it is always positive. 0 to 1.
why Gudio might have used condition
Code: [Select]
this.Rotation.w < 0
Perhaps this could help you?


If you're having such problems, you might as well abandon documenting vehicle data on server.conf and do it via script.
4
Scripting and Server Management / Re: how to obtain object information
« on February 9th, 2020, 05:05 PM »
Best option is to use a map editor out there, like MooMapper or kED.
5
Scripting and Server Management / Re: ammo problem
« on February 9th, 2020, 01:27 AM »
Try adding that code inside that VC:MP callback to onPlayerEnteringVehicle.
6
It should be...
Code: [Select]
if( IsNum("5") ) MessagePlayer( "You have typed number 5", player );
BTW, where are you running that line?
7
Support / Re: Can't reach the server downloads
« on February 3rd, 2020, 06:57 AM »
The host is down unfortunately. You'll have to wait patiently to get it back online. Say, what kind of server files are you trying to download?
8
Support / Re: FPS lag
« on January 2nd, 2020, 05:31 AM »
Does this occurs on every server? I have a GTX 1050 TI as well.
9
Support / Re: OnPlayerPart, it doesn't work, what's up????
« on January 2nd, 2020, 05:29 AM »
Can we see EchoMessage?
10
General Discussion / Re: I need your help
« on December 31st, 2019, 06:00 AM »
Quote from Kelvinvenema on December 21st, 2019, 09:11 AM
I tried
Quote from Athanatos on December 21st, 2019, 08:30 AM
Quote from umar4911 on December 21st, 2019, 05:23 AM
use Class system.
The classes in object oriented programming are not 'systems' , they are actually a type of data.
I tried to add a new stats.

class PlayerStats
{
 kills = 0;
 headshots = 0;
 deaths = 0;
 rank = 0;
 emergencypoints = 0;

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


function onPlayerDeath( player, reason )
{
switch (reason)
 {
        case 44:
        {
            Message(player.Name + " [#01403E] fell down and died.");
            break;
        }
        case 41:
        {
            Message(player.Name + " [#7D0804] exploded to bits!");
            break;
        }
        case 43:
        {
            Message(player.Name + " [#090362] drowned to death.");
            break;
        }
        case 39:
        {
            Message(player.Name + " [#23235f] died in a car accident.");
            break;
        }
        case 70:
        {
            Message(player.Name + " [#9954c3] suicided.");
            break;
        }
    }
{
  local pdeath = stats[player.ID].deaths + 1;
  QuerySQL(stats, "UPDATE pstats SET Deaths = '" + pdeath + "' WHERE Name = '" + player.Name + "'");
  rankcheck(player);
}



function onPlayerKill( player, killer, reason, bodypart )
{
rankcheck(killer);
rankcheck(player);

 if(bodypart == 6)
 {
  MessagePlayer("[#FFFFFF]You received $1000 bonus for killing through headshot", killer);
  local pkill = stats[player.ID].kills + 1;
  local phead = stats[player.ID].headshots + 1;
  QuerySQL(stats, "UPDATE pstats SET Kills = '" + pkill + "' WHERE Name = '" + killer.Name + "'");
  QuerySQL(stats, "UPDATE pstats SET Headshots = '" + phead + "' WHERE Name = '" + killer.Name + "'");
  local pdeath = stats[player.ID].deaths + 1;
  QuerySQL(stats, "UPDATE pstats SET Deaths = '"+pdeath+"' WHERE Name = '"+player.Name+"'");

 }
 else
 {
  local q2 = QuerySQL(stats, "SELECT * FROM pstats WHERE Name = '" + killer.Name + "'");
  local pkill = GetSQLColumnData(q2, 2).tointeger() + 1;
  QuerySQL(stats, "UPDATE pstats SET Kills = '" + pkill + "' WHERE Name = '" + killer.Name + "'");
  local q3 = QuerySQL(stats, "SELECT * FROM pstats WHERE Name = '" + player.Name + "'");
  local pdeath = GetSQLColumnData(q3, 2).tointeger() + 1;
  QuerySQL(stats, "UPDATE pstats SET Deaths = '"+pdeath+"' WHERE Name = '"+player.Name+"'");
 }
 
}



function onPlayerCommand(player, command, arguments)
{
local cmd, text;
cmd = command.tolower();
text = arguments;
 if(cmd == "stats")
 {
  if(!arguments)
  {
   MessagePlayer("[#FF0000]Information:[#FFFFFF] Your stats : ", player);
   MessagePlayer("[#FFFFFF]Kills : " + stats[player.ID].kills + " Headshots : " + stats[player.ID].headshots + " Deaths : " + stats[player.ID].deaths + " Rank : " + stats[player.ID].rank + "emergencypoints : " + stats[player.ID].emergencypoints + ".", player);
  }
  else
  {
   local plr = FindPlayer(arguments);
   if(!plr) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Unknown Player", player);
   else
   {
    local q = QuerySQL(stats, "SELECT * FROM pstats WHERE Name = '" + plr.Name + "'");
    MessagePlayer("[#FF0000]Information:[#FFFFFF] "+plr.Name+ " stats : ", player);
    MessagePlayer("[#FFFFFF]Kills : " + stats[player.ID].kills + " Headshots : " + stats[player.ID].headshots + " Deaths : " + stats[player.ID].deaths + " Rank : " + stats[player.ID].rank + "emergencypoints : " + stats[player.ID].emergencypoints + ".", player);
   }
  }
 }

 
   else if(cmd == "resetstats")
 {
  if(!arguments) MessagePlayer("[#FF0000]Command Error:[#FFFFFF] Use /" + cmd + " [player] ", player);
  else
  {
   local plr = FindPlayer(arguments);
   if(!plr) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Invalid player", player);
   else
   {   
    Message("[#514FFF]Administrator Command:[#FFFFFF] Admin[" + player.Name + "] reseted stats of player : " + plr.Name+ ".");
    MessagePlayer("[#FF0000]Information:[#FFFFFF] Your stats have been reseted by Admin " + player.Name + ".", plr);
    QuerySQL(stats, "UPDATE pstats SET Rank = '1', Kills = '0', Deaths = '0', Headshots = '0' Emergencypoints= '0' WHERE Name = '" + plr.Name + "'");
 stats[plr.ID].kills = 0;
stats[plr.ID].deaths = 0;
stats[plr.ID].headshots = 0;
stats[plr.ID].rank = 1;
stats[plr.ID].emergencypoints = 0;
   }
  }
 }
 
 

 
 else if(cmd == "setstats")
 {
  if(!arguments)
  {
   MessagePlayer("[#FF0000]Command Error:[#FFFFFF] Use /" + cmd + " [player] [stats(0 - 3)] [value]", player);
   MessagePlayer("0 = Rank, 1 = Kills, 2 = Headshots, 3 = Deaths, 4 = Emergencypoints", player);
  }
  else if(NumTok(arguments, " ") < 3 )
  {
   MessagePlayer("[#FF0000]Command Error:[#FFFFFF] Use /" + cmd + " [player] [stats(0 - 4)] [value]", player);
   MessagePlayer("0 = Rank, 1 = Kills, 2 = Headshots, 3 = Deaths, 4 = Emergencypoints", player);
  }
  else if(!IsNum(GetTok(arguments, " ", 2))) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Stats should be between 0 - 4", player);
  else if(!IsNum(GetTok(arguments, " ", 3))) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] value should be in numbers", player);
  else if(GetTok(arguments, " ", 2).tointeger() < 0 ) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Stats should be between 0 - 4", player);
  else if(GetTok(arguments, " ", 2).tointeger() > 4 ) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Stats should be between 0 - 4", player);
  else if(GetTok(arguments, " ", 3).tointeger() < 0 ) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Minimum value is 0", player);
  else
  {
   local plr = FindPlayer(GetTok(arguments, " ", 1));
   local stat = GetTok(arguments, " ", 2).tointeger();
   local val = GetTok(arguments, " ", 3).tointeger();
   if(!plr) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Invalid player", player);
   else
   {
    if(stat == 0)
    {
     if(val < 1) MessagePlayer("[#FF0000]Usage Error:[#FFFFFF] Rank cannot be less than 1", player);
     else QuerySQL(stats, "UPDATE pstats SET Rank = '" + val + "' WHERE Name = '" + plr.Name + "'");
  stats[plr.ID].rank = val;
     Message("[#514FFF]Developer Command:[#FFFFFF] Developer[" + player.Name + "] set Player : " + plr.Name +"'s Rank to " + val + ".");
    }
    else if(stat == 1)
    {
     QuerySQL(stats, "UPDATE pstats SET Kills = '" + val + "' WHERE Name = '" + plr.Name + "'");
     Message("[#514FFF]Developer Command:[#FFFFFF] Developer[" + player.Name + "]set Player : " + plr.Name + "'s Kills to " + val + ".");
     stats[plr.ID].kills = val;
    }
    else if(stat == 2)
    {
     QuerySQL(stats, "UPDATE pstats SET HeadShots = '" + val + "' WHERE Name = '" + plr.Name + "'");
     Message("[#514FFF]Developer Command:[#FFFFFF] Developer[" + player.Name + "] set Player : " + plr.Name+ "'s HeadShots to " + val + ".");
     stats[plr.ID].headshots = val;
    }
    else if(stat == 3)
    {
     QuerySQL(stats, "UPDATE pstats SET Deaths = '" + val + "' WHERE Name = '" + plr.Name + "'");
     Message("[#514FFF]Developer Command:[#FFFFFF] Developer[" + player.Name + "] set Player : " + plr.Name+ "'s Deaths to " + val + ".");
     stats[plr.ID].deaths = val;
   }
    else if(stat == 4)
    {
     QuerySQL(stats, "UPDATE pstats SET Emergencypoints = '" + val + "' WHERE Name = '" + plr.Name + "'");
     Message("[#514FFF]Developer Command:[#FFFFFF] Developer[" + player.Name + "] set Player : " + plr.Name+ "'s Emergencypoints to " + val + ".");
     stats[plr.ID].emergencypoints = val;
    }
   }
  }
 }
}


function rankcheck(player)
{
 local q2 = QuerySQL(stats, "SELECT * FROM pstats WHERE Name = '" + player.Name+ "'");
 local ran = GetSQLColumnData(q2, 1).tointeger();
 
 local kills = GetSQLColumnData(q2, 2).tointeger();

 if(kills >= 5000 && ran < 8)
 {
  QuerySQL(stats, "UPDATE pstats SET Rank = '8' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You have completed 5000 kills. Now your rank is 8", player);
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You received 000 cash", player);
 }
 
 else if(kills >= 4000 && ran < 7 && kills < 5000)
 {
  QuerySQL(stats, "UPDATE pstats SET Rank = '7' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You have completed 4000 kills. Now your rank is 8", player);
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You received 000 cash", player);
 }

 else if(kills >= 3000 && ran < 6 && kills < 4000)
 {
  QuerySQL(stats, "UPDATE pstats SET Rank = '6' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You have completed 3000 kills. Now your rank is 8", player);
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You received 000 cash", player);
 }

 else if(kills >= 2000 && ran < 5 && kills < 3000)
 {
  QuerySQL(stats, "UPDATE pstats SET Rank = '5' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You have completed 2000 kills. Now your rank is 8", player);
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You received 000 cash", player);
 }

 else if(kills >= 1000 && ran < 4 && kills < 2000)
 {
  QuerySQL(stats, "UPDATE pstats SET Rank = '4' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You have completed 1000 kills. Now your rank is 8", player);
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You received 000 cash", player);
 }

 else if(kills >= 500 && ran < 3 && kills < 1000)
 {
  QuerySQL(stats, "UPDATE pstats SET Rank = '3' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You have completed 500 kills. Now your rank is 8", player);
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You received 000 cash", player);
 }

 else if(kills >= 100 && ran < 2 && kills < 500)
 {
  QuerySQL(stats, "UPDATE pstats SET Rank = '2' WHERE Name = '" + player.Name + "'");
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You have completed 100 kills. Now your rank is 8", player);
  MessagePlayer("[#FF0000]Information:[#FFFFFF] You received 000 cash", player);
 }
 
}
function StatsInfo(player)
{
 local q = QuerySQL(stats, "SELECT * FROM pstats WHERE Name = '"+player.Name+"'");
 if(!q) QuerySQL(stats, "INSERT INTO pstats ( Name, Rank, Kills, Headshots, Deaths, Emergencypoints ) VALUES ( '" + escapeSQLString(player.Name) + "', '1', '0', '0', '0' '0' )");
 else
 {
 stats[player.ID].kills = GetSQLColumnData(q, 2).tointeger();
 stats[player.ID].headshots = GetSQLColumnData(q, 3).tointeger();
 stats[player.ID].deaths = GetSQLColumnData(q, 4).tointeger();
 stats[player.ID].rank = GetSQLColumnData(q, 1).tointeger();
 stats[player.ID].emergencypoints = GetSQLColumnData(q, 1).tointeger();
 
 }
 }

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 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;
}


I am running into some issues could you help me
We can't help you if you don't identify the problem you're facing with, along with screenshots.
11
Tutorials / [MVL] Re: How to import objects from GTA
« on December 27th, 2019, 12:19 AM »
Props to you, NoodlePunk!
12
Tutorials / [Windows] Re: Writing a C++ plugin
« on December 27th, 2019, 12:18 AM »
Excellent tutorial! :D #C++Squad
13
Here's a more compact way of adding cooldowns to systems. Be advised that it's untested, however in theory, it should do the trick.
Code: [Select]
fixTimer <- array( 1000, 0 ); // For vehicles. If you want one for players, use array( GetMaxPlayers(), 0 );
fixTimerValue <- 600; // 10 minutes after usage

function onPlayerCommand( player, cmd, text )
{
    switch( cmd.tolower() )
    {
        case "fix":
            if( fixTimer[ vehicle.ID ] > time() ) return MessagePlayer( "Error: You need to wait 10 minutes to repair your vehicle.", player );
            local veh = player.Vehicle;
            if( veh )
            {
                veh.Health = 1000;
                fixTimer[ vehicle.ID ] = time() + fixTimerValue;
                MessagePlayer( "Successfully repaired your vehicle.", player );
            }
        break;
    }
}
15
Community Plugins / Re: Discord
« on December 15th, 2019, 07:06 PM »
Code: [Select]
[2019-12-15 12:18:20] [connect] WebSocket Connection 162.159.135.234:443 v-2 "WebSocket++/0.8.1" /?v=6 101
[2019-12-15 12:18:26] [error] handle_read_frame error: asio.ssl:335544539 (short read)
[2019-12-15 12:18:26] [info] asio async_shutdown error: asio.ssl:335544539 (short read)
Close 4000 Unknown error.
Error 4000: unknown error - We're not sure what went wrong. Try reconnecting?
[2019-12-15 12:18:26] [disconnect] Disconnect close local:[1006,short read] remote:[4000,Unknown error.]
[2019-12-15 12:18:26] [connect] Successful connection
[2019-12-15 12:18:26] [connect] WebSocket Connection 162.159.135.234:443 v-2 "WebSocket++/0.8.1" /?v=6 101

The bot seems to lag, not only the bot itself but the server, after frequent messages sending back and forth. Any clue? This error triggers when I launch the server terminal using a batch file (which opens up if the server terminal closes)