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

#31
Scripting and Server Management / Re: Map Pos
Mar 09, 2015, 08:19 PM
just as i thought
#32
General Discussion / Re: Good News For All
Mar 09, 2015, 01:54 PM
best day of my life
#33
u not try to set player's hp to 100 when it goes above 100
player.Health = 100;
#34
Acknowledged Bug Reports / Re: Print Function
Mar 07, 2015, 03:37 PM
string.slice(starting_point,ending_point);
can do the job + you will need to add some checks about size and about slicing the text but i guess its better to wait for devs to fix it.
#35
General Discussion / Re: MySQL or SQLite?
Mar 02, 2015, 01:05 PM
nothing is better then mysql when it comes to features but for the time being i am using sqlite.
#36
Quote from: stormeus on Feb 28, 2015, 06:42 PMOne note I will make is that the length of the unique ID is 40 characters and not 25.
its 39 tried this at onPlayerJoin
local id = player.UniqueID;
print(id.len());

and you are right about varchar limit it does not matter.tried a simple test and u wr rit.
#37
Snippet Showroom / Re: Automatic Gate
Feb 28, 2015, 07:07 PM
good!!
the loop will still go through 100 of times for players every half second just sayin.but as gudio helped u on timer matter so i guess it can't be better then that.
Quote from: Sk on Feb 28, 2015, 12:52 PMAnd i removed that == 1 condition because anything which is not 0, false and null will return true.
Make sure you remember that.
#38
Snippet Showroom / Re: Automatic Gate
Feb 28, 2015, 05:26 PM
Quote from: S.L.C on Feb 28, 2015, 05:17 PM
Quote from: Beztone on Feb 28, 2015, 04:53 PMI've Got This Error Seems Timer Not Created

Move the code at line 125 above the one at 124. The order of operations is wrong in that case since the 'gate_timer' variable is created after it's being used.
Exactly just as S.L.C said how can you use the variable even before defining it?
Just to Make Sure every thing is working now i have tested it on blank script works fine for me.
#39
Snippet Showroom / Re: Automatic Gate
Feb 28, 2015, 12:52 PM
great work but you are going through the loop 100 times which i believe is not wise thing to do
so you can use a global array to decrease the loop size and to stop the timer when no one is online or spawned.
So you can do something like this.
Create a global variable for array and timer.
function onScriptLoad()
{
        gate <- CreateObject( 310, 1, -276.618, -495.992, 10.2778, 255 );
        gate_timer<-NewTimer("gatesystem", 500, 0 );
        //Using Global array for timer so that timer should not be running when no player is online of no one spawned.
gate_timer.Stop(); // No one will be spawned on startup so no need for that.
        g_Spawned<-array(1,101); // This is the global array to insert the id of player who are spawned.
}
function onPlayerSpawn(player){
//and then onPlayerSpawn insert the id of spawned player by calling Add_p function
Add_p(player);
//you stuff after this.

}
// and then call this function Remove_p where player dies or leaves.
 onPlayerDeath( player, reason )
{
Remove_p(player);
//you stuff after this.

}
onPlayerKill( killer, player, reason, bodypart )
{
Remove_p(player);
//you stuff after this.

}
onPlayerTeamKill( killer, player, reason, bodypart )
{
Remove_p(player);
//you stuff after this.

}
onPlayerPart(player,reason)
{
Remove_p(player);
//you stuff after this.

}
function Add_p(player)
{
local id = player.ID;
g_Spawned.push(id); //pushing the id of player who just spawned.
if (gate_timer.Paused) // if the timer was stopped or wasn't started.
{
gate_timer.Start(); //Start the timer as one or someone is spawned.
}
}
function Remove_p(player)
{
local id = player.ID;
if (g_Spawned.find(id)) //if player's id was inside the spawned players array.
{
local i = g_Spawned.find(id);
// array.find(val) returns the slot or index of the array where val is present.
g_Spawned.remove(i);
// removing player's id from the array.
}
//now to decrease further lag we will stop the timer if no one is spawned.
if (g_Spawned.len()<2) gate_timer.Stop();
//Smaller then 2 equals 1 which means no one is spawned and now we can stop the timer.
//as i have already created an extra value in array 101 at index 0.
}

//So now you can use your function something like this.
function gatesystem()
{
local gatestatus = 0;
foreach(i in g_Spawned ) //This will get the value from each array.
{
if (i < 100)
{
local player = FindPlayer( i);
if ( player )
{
if ( InPoly( player.Pos.x, player.Pos.y, -276.2,-503.462,-268.675,-502.296,-268.887,-488.42,-276.471,-487.991 ) ) gatestatus = 1;
}
}
}
if ( gatestatus ) gate.MoveTo( Vector( -268.576, -495.99, 10.2778 ), 2800 );
else gate.MoveTo( Vector( -276.618, -495.992, 10.2778 ), 2800 );     
}
And i removed that == 1 condition because anything which is not 0, false and null will return true.
Note : I haven't tested it but if somewhere i have some error please inform me(i may be wrong somewhere).
http://pastebin.com/EEeAC5XV just in case you like it short.
#40
Support / Re: 0.3 to 0.4
Feb 26, 2015, 03:49 PM
Quote from: Nihongo on Feb 26, 2015, 03:32 PMSO i its mean i should want to rescript right ? mean script new codes
Quote from: ysc3839 on Feb 26, 2015, 12:17 PMYou needn't convert it unless you see any error.
#41
Support / Re: 0.3 to 0.4
Feb 26, 2015, 02:43 PM
Quote from: S.L.C on Feb 26, 2015, 12:34 PM
Quote from: Nihongo on Feb 26, 2015, 12:16 PMis there any Site that convert the coding ?

Yeah sure, this can be found here http://www.easy-script-converter.net/vcmp-03-to-04?optimize=1
haha
and don't tell me you want to convert warchief into 0.4 because if you want then you should kill yourself for ruining the fun of scripting in a whole new environment.
#42
Thankx Gudio this worked the way i wanted it to work.
Brilliant Solution i must say :).
Topic Locked ;D
#43
ok thankx so i guess things don't work the way you plane.I thought of getting ride of that array.I will just wait then until you further investigate.
til then topic locked and solved
#44
i have a question guys.
i tried adding new object in CPlayer class by using new slot operator before instance is created(before onPlayerJoin function is called) but i can't change its value other then the value i used while creating it. so this is what i did
function ScriptLoad()
{
CPlayer.Kills<-0;
// same result with rawset
}
#now when the player joins the instance is created this object is auto added to the player instance but i can't change it ( some how its read-only):(.
function onPlayerJoin(player)
{
player.Kills = 10;
}
but if i use my command "kills" it still shows 0 kills
function onPlayerCommand(player,CMD,text)
{
local cmd = CMD.tolower();
if (cmd == "kills") PrivMessage(player,"Your Kills are "+player.Kills);
}
just wondering if there was any way to change their values.
#45
free skin is team 255 so when ever the killer and player are in same colour onplayerteamkill is called
few days back i converted my 0.3 script to 0.4 and i thought the same that this function is not called but after few experiments i found out that onplayerteamkill is called i fixed this problem by manually calling onplayerkill function when the team is 255
function onPlayerTeamKill(player,killer,reason,bodypart)
{
if ( player.Team == 255 ) onPlayerKill(player,killer,reason,bodypart);
// calling it manually.
}
sorry if the syntax is not correct i am on mobile :c.
hope this helps.