-
Posts
1,143 -
Joined
-
Last visited
-
Days Won
43
Everything posted by Patrick
-
-- render column when panel showing function referee.renderColumns() for i, column in ipairs (referee["Status"].columns) do dxDrawText(column[2], referee.x + textmoveX + moveSide, referee.y + positionY, sizeX, sizeY + column.height,tocolor(255,255,255,255*referee.getPanelAlpha), referee.fontSize, referee.font, "center","top",false) offsetY = offsetY + column.height end end Remove local offsetY = 0
-
Use like this -- render column when panel showing function referee.renderColumns() local offsetY = 0 for i, column in ipairs (referee["status"].columns) do dxDrawText(column[2], referee.x + textmoveX + moveSide, referee.y + positionY, sizeX, sizeY + column.height,tocolor(255,255,255,255*referee.getPanelAlpha), referee.fontSize, referee.font, "center","top",false) offsetY = offsetY + column.height end end
-
Where you call renderColumns?
-
Where you call renderColumns?
-
I think your hosting disabled it for security reasons. Contact their support.
-
I have no idea, but it's works: http://skycore.hu/test/index.php Something wrong in your webserver settings.
-
This is my server... the code don't work with that? Because it's works for me.
-
Whats the IP:PORT?
-
I don't know whats the problem because I don't know the full code and I don't really understand what you want to do. Maybe the offsetX, put it inside the for loop, after dxDrawText.
-
I don't know what is EYE1 but this code works with my server, so I think the problem is in your server settings. Check your $data variable value. Whats is in it? For me: EYE1mta22003(SkyDayZ | MTA DayZ Europe [HUN|ENG|GER]SkyDayZNone1.50060 Whats your MTA server ip and port?
-
ipairs instead of pairs at line 9.
-
Use this SDK for complex requests: https://wiki.multitheftauto.com/wiki/PHP_SDK And here is your fixed code, for request basic server informations: <?php class CSocketMTA { function CSocketMTA($IP, $PORT = 22003) { if ($socket = fsockopen("udp://$IP", $PORT + 123, $errno, $errstr)) { stream_set_timeout($socket, 1, 0); fwrite($socket, "s"); $data = fread($socket, 16384); fclose($socket); if (substr($data, 0, 4) == "EYE1") { $data = substr($data, 4); for ($i = 0; $data != ""; $i++) { if (substr($data, 0, 2) == chr(1)."?") $data = substr($data, 2); $l = ord(substr($data, 0, 1)); $buffer[$i] = substr($data, 1, $l - 1); $data = substr($data, $l); } $this->ip = $IP; $this->gameshort = $buffer[0]; $this->port = $buffer[1]; $this->name = $buffer[2]; $this->rules['game'] = $buffer[3]; $this->map = $buffer[4]; $this->rules['version'] = $buffer[5]; $this->public = $buffer[6] != "0"; $this->players = $buffer[7]; $this->maxplayers = $buffer[8]; $j = 0; for ($i = 11; $i < sizeof($buffer) - 2; $i += 5) { $this->player[$j]->name = $buffer[$i]; $this->player[$j]->score = $buffer[$i+3]; $this->player[$j]->time = 0; $j++; } } else echo "Data is invalid\n"; } else echo "Can not open socket $IP:$PORT - $errstr\n"; } }; $MTA = new CSocketMTA("dayz.skycore.hu", 22003); echo "Name: " . $MTA->name . "<br>"; echo "IP: " . $MTA->ip . "<br>"; echo "Players: " . $MTA->players."/".$MTA->maxplayers . "<br>";
-
-- SERVER SIDE addCommandHandler("destroy", function() for _, vehicle in ipairs(getElementsByType("vehicle")) do if (not getVehicleController(vehicle)) then destroyElement(vehicle); end end end)
-
-- SERVER SIDE local aclSpawns = { ["Police"] = {0, 0, 3}, } addEventHandler("onPlayerLogin", root, function(_, account) for aclname, pos in pairs(aclSpawns) do if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup(aclname)) then setElementPosition(source, pos[1], pos[2], pos[3]) return end end end) something like that
-
If fetch was success, the 'error' equals 0. So, 'if (error) then' always true. You need to terminate the function and print the error, if 'error' not equals or greater then 0. Hungarian: A visszakapott error változó mindig vesz fel értéket, ha minden rendben volt, akkor nullát. Mivel 'if (error) then' mindig igaz lesz, ezért minden esetben kilépsz a funckcióból a returnal. Correct: -- SERVER SIDE function newCommand(player, cmd, code) fetchRemote('http://domain.tld/index.php?get&code='..code, function(data, error) if (error ~= 0) then return print(error); end print("Result: " .. data); end); end addCommandHandler('cmd', newCommand);
- 1 reply
-
- 1
-
-
addCommandHandler getElementPosition getDistanceBetweenPoints3D
-
Maybe an option. https://wiki.multitheftauto.com/wiki/PHP_SDK
-
Not exactly what you want, but it might help. https://community.multitheftauto.com/index.php?p=resources&s=details&id=2542
-
1: https://wiki.multitheftauto.com/wiki/SetPlayerNametagShowing 2: I don't uderstand.
-
I think you want to run the code on server side. This is client sided code.
-
-- SERVER SIDE function onJoin() setPedArmor(source, 100) local playerName = getPlayerName(source) triggerClientEvent(source, "createInfoBox", source, "Sikeresen Bejelentkeztél", "success") end addEventHandler("onPlayerJoin", root, onJoin)
