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 MenuQuote from: StormeusFlooding the board with separate requests for many disparate items is not allowed.
If you need a whole set of things for your server, you should list them all in one thread rather than spamming this board with fifteen threads about each of the things you want your server to do.
CPlayer.newmember("ispig",true,null,false);
function onPlayerJoin(player)
{
player.ispig = false;
print(player.ispig); //prints true
}
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)
CreateXTextdraw("momo",400,500,0xFFFFFFFF);
local hi = FindXTextdraw(0);
hi.pos[1]-=10;
hi.col=0xFF3445FF;
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]
440, ID: 0
440, ID: 1
440, ID: 2
And onObjectShot event as follows:function onObjectShot(player,object,weapon)
{
print(object.Model+",.. ID: "+object.ID);
}
And then this was the output:AN ERROR HAS OCCURED [Member Variable not found]
CALLSTACK
*FUNCTION [onObjectShot()] testing.nut line [142]
LOCALS
[weapon] 17
[object] INSTANCE
[player] INSTANCE
[this] TABLE
function onObjectShot(player,obje,weapon)
{
local object = FindObject(obje.ID);
print(object.Model+",.. ID: "+object.ID);
}
[SCRIPT] 440, ID: 0
[SCRIPT] 450, ID: 1
[SCRIPT] 460, ID: 2
[SCRIPT] 440,.. ID: 0
[SCRIPT] 440,.. ID: 0
[SCRIPT] 440,.. ID: 0
<variable> <- BindKey(boolean value,hex code,some integer value(keep it 0),0 here too);
Well idk whats that boolean value for so keep true as default one. onScriptLoad() {
I <- BindKey(true, 0x49, 0, 0);
H <- BindKey(true, 0x48,0,0);
P <- BindKey(true, 0x50,0,0);
K <- BindKey(true, 0x4B,0,0);
L <- BindKey(true, 0x4C,0,0); }
Now, to use these keybindings you have onKeyDown function. Syntax: onKeyDown(player,key)
Now you can simply use your keybindings through their respective variables through switch-case or if-else if. function onKeyDown(player,key)
{
if(key==I)
{ if(player.Vehicle!=null) { local v=player.Vehicle; v.RelativeSpeed*=1.3;} }
}
Hope you like this ^_^.