-
Posts
1,255 -
Joined
-
Last visited
Everything posted by .:HyPeX:.
-
Post what you've tried so far.
-
add the option to just update its position and movement if already created? its not that hard imo..
-
Oh god, did you even ready? try it! -Do ALL the ped things server side. -Whenever a ped joins (And finishes downloading), send every client the ped info to achieve maximum syncing.
-
as i said, do everything serverside, and once a player is ready, request the server the information. This will still cause a delay, wich will create desync, in wich case, i'd recommend telling every client the new information about the ped to sync.
-
Then request it and send it back. https://wiki.multitheftauto.com/wiki/on ... ourceStart https://wiki.multitheftauto.com/wiki/triggerServerEvent https://wiki.multitheftauto.com/wiki/addEvent https://wiki.multitheftauto.com/wiki/addEventHandler https://wiki.multitheftauto.com/wiki/triggerClientEvent
-
Make all ped stuff server side, and send the data client-side.
-
Okay, i'm stuck in here... (ID is displayed as 0, but it shouldnt.) SQL table: addEventHandler('onPlayerLogin',root,function() local acc = getPlayerAccount(source) local acc = getAccountName(acc) local query = dbQuery(function(qh,player) local result = dbPoll(qh,0) local gvalue = 0 for _,row in ipairs(result) do for column,value in ipairs(row) do if column == "member_id" then gvalue = value setElementData(source, "member_id", gvalue) end end end outputConsole("id "..gvalue) outputConsole("acc "..acc) local query = dbQuery(function(qh,player) local result = dbPoll(qh,0) id, photo = "","" for _,row in ipairs(result) do for column,value in ipairs(row) do if column == "pp_member_id" then id = value elseif column == "pp_main_photo" then photo = value setElementData(player, "avatar", value) end end end outputConsole("1 "..id.." "..photo) fetchImage(id, photo) end,{player},Database, "SELECT pp_member_id,pp_main_photo FROM profile_portal WHERE pp_member_id = '?'", gvalue) end,{source},Database, "SELECT member_id FROM members WHERE name='"..acc.."'") end) function fetchImage(id,photo) outputConsole("2 "..id.." "..photo) fetchRemote ( "http://emp-clan.eu/uploads/"..photo, returnImage, "", false, id,photo ) end function returnImage(image, error, id, photo) outputConsole("3 "..id.." "..photo) if fileExists("saved/"..photo) then local file = fileOpen("saved/"..photo) local size = fileGetSize(file) fileClose(file) local result = fileRead(file,size) if result ~= image then fileDelete("saved/"..photo) local file = fileCreate("saved/"..photo) fileWrite(file, image) fileClose(file) end else local file = fileCreate("saved/"..photo) fileWrite(file, image) fileClose(file) end end Console output: Press 'p' to open your admin panel login: You successfully logged in id 0 acc hypex 1 2 3
-
If the car is server-side, it will follow a server element, wich is unstable (I.e. has a possible sync lag)
-
local time = getRealTime() local timestamp = time.timestamp local vipEND = timestamp + ( 1 * 60 * 60 * 24 * 30 )
-
your code has absolutly no sense at all. addEventHandler("onPlayerLogin",root, function ( ) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin")) then setPlayerTeam(source, getTeamFromName("Staff")) end end )
-
Hello, i've thought about this; Couldnt we specify the type of syntax we're using for a more simplified looking? i.e: [ lua = client ] or [ lua = server ] / [ lua = shared ] In this way people in the scripting forum could actually retrive more easily if the code they're looking at is client or server and save time.
-
You're doing it wrong (not sure why neargreen asked the code, if he didnt actually readed what you posted). You are triggering the event over itself, over and over, but then asking for arguments in a part where they dont exist. Also, next time, use debugscript before asking for help, becouse it would obviously have outputted that IP doesnt exist. And last, i'm just saving this part of the code, the rest you did has no logic at all. (At least ButtonSel function) Server: addEvent('event1',true) addEventHandler('event1',root, function(selected, player) triggerClientEvent (client, "ToClient",resourceRoot, getPlayerIP(client) ) end ) Client: function ButtonSel(button, state, absoluteX, absoluteY,player,ip) if (source == button) then guiSetText ( aTab1.Name, "IP: "..ip) triggerServerEvent('event1',localPlayer,guiGridListGetItemText ( aTab1.PlayerList, guiGridListGetSelectedItem ( aTab1.PlayerList ), column ),localPlayer) end end function Whatever(ip) aTab1.Name = "IP: "..ip end addEvent( "ToClient", true ) addEventHandler( "ToClient", localPlayer,Whatever )
-
Have fun scripting, and read my explanation! function formatTimeFromMinutes(value) if value then local weekday = math.floor(value / 1440) local value = value - ( math.floor(weekday) * 1440 ) local hours = math.floor(value/24) local value = value - ( math.floor(hours) * 24 ) local minutes = math.floor( value ) weekday = ("%02"):format(tostring(math.round(weekday))) hours = ("%02"):format(tostring(math.round(hours))) minutes = ("%02"):format(tostring(math.round(minutes))) value = weekday.. ":" ..hours .. ":" .. minutes return value end return false end --[[ MATH EXPLANATION Eg time: 1764 weekday = 1764 / 1440 = 1.225 math.floor(weekday) = 1 value = value - weekday(1) * 1440 -> Remove correctly value = 324 hours = 324 / 24 = 13.5 math.floor(hours) = 13 value = value - hours(13) * 24 -> Remove correctly value = 324 - 312 = 12 minutes = value --> Remaining is minutes Result = 1 Day : 13 Hours : 12 minutes ]]
-
I'm not sure what you're doing, but check how i make min:seg:ms time = tostring(time) ms = tostring(math.round(tonumber((time/1000 - ("%02d"):format(time/1000))*1000))) min = (((time-ms)/1000)/(60)) diff = (min - math.floor(min))*60 ms = ("%03d"):format(tostring(math.round(ms))) min = ("%02d"):format(tostring(math.round(min))) sec = ("%02d"):format(tostring(math.round(diff)))
-
Basically you would mute every sound that way. Remember to save them and play them again later tho
-
No, nevermind about that, i'm using just forum avatars in-game. I just need a good way to check if users change them
-
And how now i'm thinking of creating a serverside constant working thingy to send the clients the images if they need them, How could i check the images in case they change and know if they do? could i compare the file text with the fetchRemote?
-
As far as i know, the fetchRemote returns a material element and fileWrite needs a string https://wiki.multitheftauto.com/wiki/DxGetTexturePixels I'm just converting the image to pixels.. (My bad, typo there)
-
i need to set the images as attribute-false (And the IDs are managed by the website, so i cannot know them), so discard downloadFile.. How could i use fileWrite? i thought about this.. would this be correct? local texture = text -- from fetchRemote local string = dxGetPixels(texture) local file = fileCreate("Id-photo.txt") fileWrite(file, string) fileClose(file) --- Later on -- onLoad: local file = fileOpen("Id-photo.txt") local string = fileRead(file, fileGetSize(file)) fileClose(file) local texture = dxCreateTexture(string, 128,128)
-
How so? fetchRemote provides the material but not a way to save them..
-
Well, i want to make a download system in wich you would actually download images (With fetchRemote). But, having said that, can i just directly draw them with dxDrawImage? My idea was something like this: function() if fetch.id then return end if not fileExists(":avatars/saved/id.png") then fetchRemote("page/uploads/photo-id.png") fetch.id = true end end -- onClientRender dxDrawImage(":avatars/saved/id.png") My issue is: Can i actually store the file and leave it there? (To avoid re-downloads mostly) Else i would just make them re-download on each join but even thought most images are not big size, some can actually be 200kb, and said that it will be one for each player... i'd prefer to dont have to re-download them..
-
Just lock the ped inside a room somewhere, with the camera infront, and then use dxDrawMaterialLine3D.
-
Sorry my friend, more the problem is the LUAC.MTASA.COM they we do not support for all languages, because they think only in English Then write it yourself (Wich i doubt you can), if you are not willing to use the original compiler then we cant do much. And by the way, it is lua bytecode, not mta's fault.
-
You'll need to make an unique identifier for each vehile (And most likely, store it on it as element data as it will be attached to it) dbExec (dbConnection, "UPDATE Pojazdy SET Vehicle_ID='" .. model .. "', LastPosX='" .. x .. "', LastPosY='" .. y .. "',LastPosZ='" .. z .. "',LastRotX='" .. rx .. "',LastRotY='" .. ry .. "',LastRotZ='" .. rz .. "' WHERE Unique_ID = '"..getElementData(vehicle, "uniqueID").."'") Always remember to delete the row value when the vehicle is lost or destroyed, so carefully check on that. Moreover: http://www.w3schools.com/sql/sql_where.asp
-
only it's not ready yet, I need more people to help in understanding Its a pretty easy animation thought, just use "OutBounce". It does that effect.