Currently the developers are putting their own money into JC2-MP to keep the servers online.

Please take a few seconds of your time and disable your AdBlock plugin for our website.

Ad revenue is not going to developers, it is used purely for covering our hosting costs.

 

You are also free to donate, which removes all ads from our website!

Patch 0.3 was just released! Full changelog here: https://t.co/4A50m6IKen

2 years ago

Advertisement
August 23, 2019, 03:46:53 pm

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.


Topics - SneakBug8

Pages: [1]
1
Which event is called when player gets points of chaos?

2
Pусский (Russian) / Эвент Хаоса
« on: November 20, 2015, 03:27:36 pm »
Какой эвент вызывается при получении игроком очком хаоса и могу ли я эти очки узнать и использовать в скриптах. Целью является начисление денег за разрушения на моем фракционном сервере вместо ужасно сложных скриптов на грабежи.

3
Scripting support / Lua help
« on: November 19, 2015, 04:04:06 pm »
Well, i wrote better chat script for my server, but it actually not working: no such operator defined on line 13.
Code: [Select]
function PlayerChat (args)
color = Color (255,255,255)
message = nil
if string.match(args.text, "/me") then
color = Color (255,222,173)
message=string.sub(args.text, 4)
elseif string.match(args.text, "/b") then
color = Color (208,208,208)
message=string.sub(args.text, 3)
else
message=args.text
end
send = args.player..":"..message
Chat:Broadcast(send, Color(255,255,255))
end
Events:Subscribe("PlayerChat", PlayerChat)
But i dont know, why...

4
Scripting support / Making invisible walls using player coordinates
« on: November 18, 2015, 03:55:42 pm »
I was trying to make script for making invisible walls without making any objects:
Code: [Select]
class 'Borders'

function Borders:__init()
    self.AnnounceTimer = Timer()
    self.AnnounceDelay = 5 -- How often you want your message to broadcast (in minutes)
    self.active = true -- set to true to enable and false to disable

    Events:Subscribe("PostTick", self, self.Tick)
end

function Borders:Tick(args)
     if self.active then
       if self.AnnounceTimer:GetSeconds() > 5 then
   for player in Server:GetPlayers() do
         pos = player:GetPosition()
x = math.abs(pos.x)
y= math.abs(pos.y)
Chat:Broadcast("Attancion!", Color(255, 255, 255))
if x<15271 or x>4021 or y<346.15 or y>450 then
Chat:Broadcast("Return to City!", Color(255, 255, 255))
         self.AnnounceTimer:Restart()
       end
   end
    end
end
end

borders = Borders()
     
But it is always Broadcasting 'Return to City' even if i am in Panau City.

5
Scripting support / /setspawn fixing
« on: November 17, 2015, 04:33:58 pm »
I need to modify this script to save custom spawns in SQLite and read them, when player logged in:
Code: [Select]
newSpawns = {}

playerChat = function(args)
if args.text == "/setspawn" then
pos = args.player:GetPosition()
for k, v in pairs(newSpawns) do
if v.ply == args.player then
table.remove(newSpawns, k)
end
end
table.insert(newSpawns, {ply = args.player, loc = pos})
args.player:SendChatMessage("New Spawn Point Set at "..pos.x.." "..pos.y.." "..pos.z, Color(255, 0, 0))
end
end

newSpawn = function(args)
loc = Vector3(0, 0, 0)
for k, v in pairs(newSpawns) do
if v.ply == args.player then
loc = v.loc
args.player:SetPosition(v.loc)
args.player:SendChatMessage("Warped To Custom Spawn Point at "..v.loc.x.." "..v.loc.y.." "..v.loc.z, Color(255, 0, 0))
end
end
return false
end

Events:Subscribe("PlayerSpawn", newSpawn)
Events:Subscribe("PlayerChat", playerChat)

6
Pусский (Russian) / [RUS] JC2-RP server {in development}
« on: November 13, 2015, 09:24:37 pm »
Здравствуйте, все.
Как я писал раньше, занимаюсь созданием первого русского RP сервера в JC2-MP. В связи с большим для 1 человека объема работ, ищу людей, заинтересованных в сервере и готовых помочь скриптингом.
( Ваш уровень LUA не важен! Важно лишь желание его изучить и помочь, в принципе, если у вас не выходит с lua, но вы желаете помочь - мы найдем вам место и дело)
Желающие - пишите мне в ЛС здесь или в Steam ( ник тот же ) или в ВК ( Павел Наконечный )
Группа планируемого сервера: http://vk.com/jc2rp

7
Scripting support / Fixing script
« on: November 13, 2015, 06:05:13 pm »
Was writing money system to my server, using info from wiki, but server dont load it.
Code: [Select]
function register (args)
SQL:Execute('CREATE TABLE IF NOT EXISTS players (steamID VARCHAR UNIQUE, money INTEGER, modelID INTEGER)')
SQL:Execute('DROP TABLE IF EXISTS players')
local command = SQL:Command('INSERT INTO players (steamID, money, modelID) VALUES (steam_id, 1000, 1)')
end
function checkmoney (args)
if args.message == "/checkbalance" then
local query = SQL:Query('SELECT money FROM players WHERE steamID = steam_id LIMIT 1')
query:Bind
money = result.money -- 1 is the row, money is the name of the column
print (args.player, money)
end
end
function getmoney (args)
if args.message == "/getmoney" then -- убрать после добавления работ
local query = SQL:Query('SELECT money, modelID FROM players WHERE steamID = steam_id LIMIT 1')
query:Bind
local result = query:Execute()
local money = result[1].money -- 1 is the row, money is the name of the column
local command = SQL:Command('UPDATE players SET money = ? WHERE steamID = ?')
money = money + 100
command:Bind(1, money) -- money
command:Bind(2, steam_id) -- steamID
print (args.player, money)
end -- убрать после добавления работ
end
Events:Subscribe("Playerchat", checkmoney)
Events:Subscribe("Getmoney", getmoney)
Where is error? How can i fix it?

Pages: [1]