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 - karan20000000000

#31
Off-Topic General / Re: IRC Logs
Jan 16, 2016, 04:15 PM
~SLC: YES I'M A PIG!
~SLC: LET EVERYONE KNOW IT!
#32
Support / Re: A little help.
Dec 24, 2015, 05:13 PM
Delete the 04rel003 folder in vcmp root folder and restart the browser. If it redownloads the version properly you might be able to run the game properly.
#33
Quote from: Doom_Kill3R on Dec 14, 2015, 09:18 AMSo what is the advantage of this over the default functions?
a couple of features have been added to textdraws
If you look at the stuff above, you can see what all has been added.
The txd.text was one of feature which most of us wanted to exist in default implementation.
#34
The topic itself is self explanatory; a couple of features have been added to textdraws.
XTextdraw
     .ID         //ID of xtxd instance
     .text      //The text to be displayed
     .pos      //The array containing x,y coord of txd
     .col       //The hex color of txd.
     .obj      //The actual textdraw instance
     .players  //An array containing players to which an instance of xtextdraw is being visible
     .ShowForAll()
     .ShowForPlayer(player)
     .HideFromAll()
     .HideFromPlayer(player)
     .SetRelativeForAll(boolean)
     .Delete()

 CreateXTextdraw(text,x,y,colour)
 FindXTextdraw(id)

An example to illustrate above functions:
CreateXTextdraw("momo",400,500,0xFFFFFFFF);
local hi = FindXTextdraw(0);
hi.pos[1]-=10;
hi.col=0xFF3445FF;

I didn't add  Textdraw.SetPosForAll, Textdraw.SetPosForPlayer, Textdraw.SetColourForAll, Textdraw.SetColourForPlayer because they will require a different approach. In case you use them, try modifying the code yourself.
Since this is the very first release, so there could be a couple of bugs. Just put them down.
Link to snippet: clicky
[spoiler=Main Code]
class XTxd
{
    text = null;
    ID = null;
    pos = null;
    col = null;
    obj = null;
    players = null;
    isvta = false;
    isrfa = false;

    //static for these
    count = [0];
    timer = [null];
    objs = [];

    constructor(str,x,y,colr) {
      count[0]++;
      if(pos==null)
      {
        pos = [0,0];
        players = [];
      }
      text = str;
      pos = [x,y];
      col = colr;
      obj = ::CreateTextdraw(str,x,y,colr);

      local did=false;
      for(local i=0;i<XTxd.objs.len();i++)
      {
        local dat = XTxd.objs[i];
        if(dat==null)
        { XTxd.objs[i] = this; did=true; ID = i; break; }
      }
      if(did!=true)
      {
        XTxd.objs.push(this);
        ID = XTxd.objs.len()-1;
      }

      if(count[0] == 1)
      {
        timer[0] = ::NewTimer("ref",1000,0);
      }

    }

    static function refresh()
    {
      for(local i=0;i<objs.len();i++)
      {
        local o =   objs[i];
        if(o!=null)
        {
            o.obj.Delete();
            o.obj = ::CreateTextdraw(o.text,o.pos[0],o.pos[1],o.col);
            o.obj.SetRelativeForAll(o.isrfa);
            if(o.isvta==true) o.obj.ShowForAll();
            else if(o.players.len()>0)
            {
              foreach (plr in o.players)
               {
                o.obj.ShowForPlayer(plr);
               }
            }
        }
      }
    }

    function ShowForPlayer(player)
    {
      players.push(player);
    }
    function ShowForAll()
    {
      isvta = true;
    }
    function HideFromPlayer(player)
    {
      if(players.find(player)!=null)
      {
        players.remove(players.find(player));
      }
    }
    function HideFromAll()
    {
      isvta = false;
    }
    function SetRelativeForAll(val)
    {
      isrfa = val;
    }
    function Delete()
    {
      obj.Delete();
      objs[ID] = null;
      --count[0];
    }

}

function CreateXTextdraw(str,x,y,col)
{
  return XTxd(str,x,y,col);
}
function FindXTextdraw(id)
{
  for(local i=0;i<XTxd.objs.len();i++)
  {
    if(XTxd.objs[i]!=null && id == XTxd.objs[i].ID) return XTxd.objs[i];
  }
  return null;
}

function ref()
{
  XTxd.refresh();
}
[/spoiler]
#35
Scripting and Server Management / Re: Line
Oct 31, 2015, 07:13 AM
The actual code is by Thijn
function onScriptLoad()
{
seterrorhandler( errorHandling );
}

function errorHandling( obj )
{
local callingStack = getstackinfos( 2 );
local funcName = callingStack.func;
local origin   = callingStack.src;
local lineNo   = callingStack.line;
local locals   = "";

foreach( index, value in callingStack.locals )
{
if( index != "this" )
locals = locals + "\t[" + index + "]: " + value + "\n";
}

EchoMessage( "Error occurring in " + origin + ": " + lineNo + ", function: " + funcName + "." );
EchoMessage( ">> " + obj + "\n" );
EchoMessage( locals );
}
Note: seterrorhandler is built-in function. Make sure the EchoMessage function is defined in your script.
#36
Update to version 3 released. Check first post!
#37
General Discussion / Re: Damn it!
Aug 19, 2015, 11:29 AM
Quote from: Doom_Killer on Aug 19, 2015, 11:23 AMSince it is 'custom' object it is going to be downloaded first before creating it for player, then it doesn't matter if its xml or CreateObject since the object is already at your PC.

I'm not talking about custom objects, I'm talking about the mapping. To be more specific I'm talking about mapping done using inbuilt objects through CreateObject statement.
#38
General Discussion / Re: Damn it!
Aug 19, 2015, 11:09 AM
Considering the part of custom mapping, its better to use CreateObject statements to prevent this. The only problem with this is, objects will be streamed directly which is not as good as xml.
#39
I think this is what you want to implement
function onPlayerExitVehicle(player,vehicle)
{
          if(vehicle.Locked==true) { vehicle.Locked = false; player.Vehicle = vehicle; vehicle.Locked = true; }
}
Its untested by the way.

I don't think so player.PutInVehicleSlot() would be a good idea because when the car's having speed and player tries to get out of car, this function is unable to put him back in the car.
#40
Quote from: Thijn on Jul 18, 2015, 11:38 AMDo you actually read replies before posting?
Sorry, removed it.
#41
Wait, you didn't give download link for brain !!!!!!!!!!!!!!!
#42
simple but then i dont think so you'll be able to join server. Just add this line in server.cfg
version potato
#43
Update released! See first post!
#44
#TommySelfiesWhileFlyingHydra ;D