Jump to content

.:HyPeX:.

Members
  • Posts

    1,255
  • Joined

  • Last visited

Everything posted by .:HyPeX:.

  1. You must not write it console, you'd need to use runcode, and i doubt you know what you're doing. Go to admin panel - resources tab. On the small part where you can write down code and execute it - write "aclReload()" and press server. i already did this myself with admin panel and runcode - it works perfectly.
  2. Thank You. Can i use onClientCursorMove getCursorPosition Its usless hunterix, the onClientCursorMove already retrives the cursor position values, it even give the 3 types, screen relative, screen pixels and world XYZ. onClientCursorMove - Check it out
  3. Use the original GetRealTime and check results.
  4. Probably you're just misunderstanding. The one at your server is labelled DD/MM/YY, while the one at the converter is labelled MM/DD/YY.
  5. It is just detected from the server / client machine it was run from. if you use a client-side code, you'll be fine. it'll show the player its correct time.
  6. Use a mysql database and update it on player join or player quit. Other than that just have a PHP system amongst the servers you have. I'd go for the mysql thought. much easier.
  7. Tried so far and it seems fixed, i'd need a realtime test to know if it does fix it. For now that seems to work, but i got an issue aside, when there's more than one player, i've got a podium script when all players die. (I let the single one live until it dies, deathmatch mode). My issue is that when there's more than one player, the podium has black-outs, the camera moves away, i'm afraid, and i dont know why. And this only happens with 2 or more players. My idea was that maybe the spectators as it failed to have a target, it simply moves the camera away (As it'd do if all alive players went spectating). Where is this part of the spectating to test if disabling it fixes it?
  8. Only 2 matches found. From race_server: addEvent('onNotifyPlayerReady', true) addEventHandler('onNotifyPlayerReady', g_Root, function() if checkClient( false, source, 'onNotifyPlayerReady' ) then return end setPlayerReady( source ) for i, pickupID in ipairs(unloadedPickups) do -- outputDebugString(getPlayerName(source).." unload "..tostring(pickupID)) clientCall(source, "unloadPickup", pickupID ) end end function setPlayerReady( player ) setElementData(player, "state", "alive") g_NotReady[player] = false g_NotReadyTimeout = getTickCount() + 20000 if _DEBUG_TIMING then g_NotReadyTimeout = g_NotReadyTimeout - 10000 end -- Set max timeout to 30 seconds after first person is ready if not g_NotReadyMaxWait then g_NotReadyMaxWait = getTickCount() + 30000 end end
  9. Okay then, came down to this: if g_CurrentRaceMode.isPlayerFinished(player) then -- Joining 'finished' clientCall(player, "Spectate.start", 'auto' ) setPlayerStatus( player, nil, "waiting" ) else if bPlayerJoined and g_CurrentRaceMode.running then -- Joining after start addActivePlayer(player) if g_GameOptions.joinspectating then clientCall(player, "Spectate.start", 'manual' ) setPlayerStatus( player, nil, "spectating") Override.setCollideOthers( "ForSpectating", RaceMode.getPlayerVehicle( player ), 0 ) end end end There's only one way it wouldnt be set an spectating state, wich would be if the first if failed, and then it didnt matched one of the following ones, g_GameOptions.joinspectating would be set from the admin panel, right? EDIT: Its not that maybe, what sets the player to "alive" state? it might be aswell be set alive state prematurely..
  10. I didnt found any errors with it, but i might be missing something, this is the function (Certainly longer than what i expected) function joinHandlerBoth(player) if #g_Spawnpoints == 0 then -- start vote if no map is loaded if not TimerManager.hasTimerFor("watchdog") then TimerManager.createTimerFor("map","watchdog"):setTimer( function() if #g_Spawnpoints == 0 then outputDebugString('No map loaded; showing votemanager') TimerManager.destroyTimersFor("spawn") RaceMode.endMap() end end, 1000, 1 ) end return else TimerManager.destroyTimersFor("watchdog") end if TimerManager.hasTimerFor("spawn") then for i,p in ipairs(getElementsByType('player')) do if not table.find(g_Players, p) then player = p break end end if not player then -- Is everyone ready? if howManyPlayersNotReady() == 0 then TimerManager.destroyTimersFor("spawn") if stateAllowsGridCountdown() then gotoState('GridCountdown') g_RaceStartCountdown:start() end end return end end local bPlayerJoined = not player if bPlayerJoined then player = source setPlayerStatus( player, "joined", "" ) else setPlayerStatus( player, "not ready", "" ) end if not player then outputDebug( 'MISC', 'joinHandler: player==nil' ) return end table.insert(g_Players, player) local vehicle if true then local spawnpoint = g_CurrentRaceMode:pickFreeSpawnpoint(player) local x, y, z = unpack(spawnpoint.position) -- Set random seed dependant on map name, so everyone gets the same models setRandomSeedForMap('clothes') if g_MapOptions.skins == 'cj' then spawnPlayer(player, x + 4, y, z, 0, 0) local clothes = { [16] = math.random(12, 13), [17] = 7 } -- 16=Hats(12:helmet 13:moto) 17=Extra(7:garageleg) for vehicles,vehicleclothes in pairs(g_VehicleClothes) do if table.find(vehicles, spawnpoint.vehicle) then for type,index in pairs(vehicleclothes) do clothes[type] = index or nil end end end local texture, model for type,index in pairs(clothes) do texture, model = getClothesByTypeIndex(type, index) addPedClothes(player, texture, model, type) end elseif g_MapOptions.skins == 'random' then repeat until spawnPlayer(player, x + 4, y, z, 0, math.random(9, 288)) else local ok for i=1,20 do ok = spawnPlayer(player, x + 4, y, z, 0, getRandomFromRangeList(g_MapOptions.skins)) if ok then break end end if not ok then spawnPlayer(player, x + 4, y, z, 0, 264) end end setPlayerSpectating(player, false) setPlayerNotReady( player ) setPedStat(player, 160, 1000) setPedStat(player, 229, 1000) setPedStat(player, 230, 1000) if spawnpoint.vehicle then setRandomSeedForMap('vehiclecolors') -- Replace groups of unprintable characters with a space, and then remove any leading space local plate = getPlayerName(player):gsub( '[^%a%d]+', ' ' ):gsub( '^ ', '' ) vehicle = createVehicle(spawnpoint.vehicle, x, y, z, 0, 0, spawnpoint.rotation, plate:sub(1, -- s8) -->) if setElementSyncer then setElementSyncer( vehicle, false ) end g_Vehicles[player] = vehicle Override.setAlpha( "ForRCVehicles", player, g_RCVehicleIDs[spawnpoint.vehicle] and 0 or nil ) RaceMode.playerFreeze(player) outputDebug( 'MISC', 'joinHandlerBoth: setElementFrozen true for ' .. tostring(getPlayerName(player)) .. ' vehicle:' .. tostring(vehicle) ) if bPlayerJoined and g_CurrentRaceMode.running then unfreezePlayerWhenReady(player) end if g_MapOptions.respawn == 'none' and not stateAllowsSpawnInNoRespawnMap() then g_CurrentRaceMode.setPlayerIsFinished(player) setElementPosition(vehicle, 0, 0, 0) end if spawnpoint.paintjob or spawnpoint.upgrades then setVehiclePaintjobAndUpgrades(vehicle, spawnpoint.paintjob, spawnpoint.upgrades) else if g_MapOptions.autopimp then pimpVehicleRandom(vehicle) end if g_GameOptions.vehiclecolors == 'random' then setRandomSeedForMap('vehiclecolors') local vehicleColorFixed = false for vehicleID,color in pairs(g_FixedColorVehicles) do if vehicleID == tonumber(spawnpoint.vehicle) then if color then setVehicleColor(vehicle, color[1], color[2], color[3], color[4]) end vehicleColorFixed = true break end end if not vehicleColorFixed then setVehicleColor(vehicle, math.random(0, 126), math.random(0, 126), 0, 0) end end end warpPedIntoVehicle(player, vehicle) end destroyBlipsAttachedTo(player) createBlipAttachedTo(player, 0, 1, 200, 200, 200) g_CurrentRaceMode:onPlayerJoin(player, spawnpoint) end -- Send client all info local playerInfo = {} playerInfo.admin = isPlayerInACLGroup(player, g_GameOptions.admingroup) playerInfo.testing = _TESTING playerInfo.joined = bPlayerJoined local duration = bPlayerJoined and (g_MapOptions.duration and (g_MapOptions.duration - g_CurrentRaceMode:getTimePassed()) or true) clientCall(player, 'initRace', vehicle, g_Checkpoints, g_Objects, g_Pickups, g_MapOptions, g_CurrentRaceMode:isRanked(), duration, g_GameOptions, g_MapInfo, playerInfo ) if bPlayerJoined and getPlayerCount() == 2 and stateAllowsRandomMapVote() and g_GameOptions.joinrandomvote then -- Start random map vote if someone joined a lone player mid-race TimerManager.createTimerFor("map"):setTimer(startMidMapVoteForRandomMap,7000,1) end -- Handle spectating when joined if g_CurrentRaceMode.isPlayerFinished(player) then -- Joining 'finished' clientCall(player, "Spectate.start", 'auto' ) setPlayerStatus( player, nil, "waiting" ) else if bPlayerJoined and g_CurrentRaceMode.running then -- Joining after start addActivePlayer(player) if g_GameOptions.joinspectating then clientCall(player, "Spectate.start", 'manual' ) setPlayerStatus( player, nil, "spectating") Override.setCollideOthers( "ForSpectating", RaceMode.getPlayerVehicle( player ), 0 ) end end end end isPlayerFinished relates to what? the conflict might come from there.
  11. Hello everyone, i've got a bug with my race gamemode, and it is that the players when joining, they arent set ever the "waiting" state, they're set alive, wich is annoying for all my customization i do arround the race state, becouse it detects alive players, wich are not. Where in the race is the "Waiting" state supposed to appear? So i can check if there's something faulty between the lines. Thanks HyPeX
  12. Yeah, is basically the same as checking if the index exists, and if it does, then just do it. I was doing this with dbExec on resource start, but a double query would be usless (In terms of performance, for the intention). I guess i'll just carry on with the warning, thanks
  13. Solved it, it was some bad misconfig rule for outgoing connections from the VPS.
  14. Its server side fetchremote, and actually it is not in the same server...
  15. No one? 100 views already... I finally tracked down the issue to server side - The files are cut on 5byte. I tested checking if the files were cut by a request client-side - without client side, on player login a 5byte file is created. I checked, it was a txt with "ERROR". (Badly i didnt checked for error argument) Error id is 215 - What is 215? Its not listed in the wiki. EDIT: Error 215 was a wrong argument passed - i now get error 404 - even thought the file exists! [url=http://emp-clan.eu/uploads/profile/photo-215.png]http://emp-clan.eu/uploads/profile/photo-215.png[/url] ERROR 404 215 ERROR OBTAINING IMAGE. ERROR ID: 215 function fetchImage(id,photo) outputChatBox("http://emp-clan.eu/uploads/"..photo) fetchRemote ( "http://emp-clan.eu/uploads/"..photo, returnImage, "", false, id,photo ) end function returnImage(image, error, id, photo) outputChatBox(image.." "..error.." "..id) if errro ~= 0 then outputChatBox("ERROR OBTAINING IMAGE. ERROR ID: ".. id) else if fileExists("saved/"..photo) then local file = fileOpen("saved/"..photo) local size = fileGetSize(file) local result = fileRead(file,size) fileClose(file) 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 end
  16. As the topic name says, how can i achive this? The following statement wont work: "ALTER TABLE table_name ADD IF NOT EXISTS g_achivements varchar(255);" If i just make it and the column already exists it will say duplicate column, how can i skip the error appeareance? Greetz HyPeX PD: I'd also like to know how can i set a default value to the column.
  17. Bump, anyone? i cannot find any reason for this not to work...
  18. Hello everyone i've found one issue with my custom downloading images from the forum (Avatars) system. It fucks up alone when there is more than one player online and the images are saved with 5bytes. if i'm alone on the server it downloads my avatar perfectly. Server: local Database = dbConnect("mysql",***) gTable = {} 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 setElementData(player, "member_id", result[1]["member_id"]) gvalue = result[1]["member_id"] local query = dbQuery(function(qh,player) local result = dbPoll(qh,0) id, photo = "","" id = result[1]["pp_member_id"] photo = result[1]["pp_main_photo"] if photo ~= "" then setElementData(player, "pp_main_photo", result[1]["pp_main_photo"]) else setElementData(player, "pp_main_photo", "profile/photo-0.jpg") end 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) fetchRemote ( "http://emp-clan.eu/uploads/"..photo, returnImage, "", false, id,photo ) end function returnImage(image, error, id, photo) if fileExists("saved/"..photo) then local file = fileOpen("saved/"..photo) local size = fileGetSize(file) local result = fileRead(file,size) fileClose(file) 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 addEvent("RequestAvatars",true) addEventHandler("RequestAvatars", root, function(player,id,photo,size) if size then local file = fileOpen("saved/"..photo) if size ~= fileGetSize(file) then local info = fileRead(file,fileGetSize(file)) fileClose(file) triggerClientEvent(client,"SaveAvatars",resourceRoot,id,photo,info) end fileClose(file) else if fileExists("saved/"..photo) then local file = fileOpen("saved/"..photo) local info = fileRead(file,fileGetSize(file)) fileClose(file) triggerClientEvent(client,"SaveAvatars",resourceRoot,id,photo,info) end fileClose(file) end end) Client addEventHandler('onClientResourceStart',root,function() for i,v in ipairs(getElementsByType("player")) do local id = getElementData(v, "member_id") local photo = getElementData(v, "pp_main_photo") if photo then if fileExists("saved/"..photo) then local file = fileOpen("saved/"..photo) local size = fileGetSize(file) fileClose(file) outputConsole(size) triggerServerEvent("RequestAvatars", resourceRoot, localPlayer,id, photo, size) else triggerServerEvent("RequestAvatars", resourceRoot, localPlayer,id, photo) end end end end) addEvent('SaveAvatars',true) addEventHandler('SaveAvatars', root, function(id,photo,info) if info then if fileExists("saved/"..photo) then fileDelete("saved/"..photo) local file = fileCreate("saved/"..photo) fileWrite(file, info) fileClose(file) else local file = fileCreate("saved/"..photo) fileWrite(file, info) fileClose(file) end setElementData(localPlayer, photo, true) end end) addEventHandler('onClientElementDataChange',root,function(name,old) if name == "pp_main_photo" then local id = getElementData(source, "member_id") local photo = getElementData(source, "pp_main_photo") if photo then if fileExists("saved/"..photo) then local file = fileOpen("saved/"..photo) local size = fileGetSize(file) fileClose(file) outputConsole(size) triggerServerEvent("RequestAvatars", resourceRoot, localPlayer,id, photo, size) else triggerServerEvent("RequestAvatars", resourceRoot, localPlayer,id, photo) end end end end)
  19. Do this: -Backup the database - Flush it - Test again if you get random player stats.
  20. Still. I belive it is related to getScreenFromWorldPosition as this function has a delay on startup.
  21. addEventHandler('onClientRender',root,function() for i,v in ipairs(getElementsByType('player')) do local veh = getPedOccupiedVehicle(v) if veh then if isElementOnScreen(veh) then local x,y,z = getElementPosition(veh) local s = getElementRadius ( veh ) local z = z+s/3 local sx,sy = getScreenFromWorldPosition(x,y,z) local id = getElementData(v,"member_id") or 0 if not sx then return end if not font then return end dxDrawImage(sx-22-(dxGetTextWidth(getPlayerName(v):gsub("#%x%x%x%x%x%x",""),1,font)/2),sy-15,40,40,":avatars/saved/profile/photo-"..id..".png") dxDrawText(getPlayerName(v),sx+20,sy,sx+20,sy,tocolor(255,255,255,255),1,font,"center","center",false,false,true,true) dxDrawText(getPlayerName(v):gsub("#%x%x%x%x%x%x",""),sx+20,sy+1,sx+20,sy+1,tocolor(0,0,0,255),1.02,font,"center","center",false,false,false,true) local hp = getElementHealth(v) local width = dxGetTextWidth(getPlayerName(v):gsub("#%x%x%x%x%x%x",""),1,font) dxDrawRectangle(sx-width/2+20,sy+15,width,8,tocolor(0,0,0,180)) dxDrawRectangle(sx-width/2+2+20,sy+15+2,width-4,4,tocolor(0,255,0,180)) end end end end) I did this, but when the car moves (I'm testing on my own car) the text vibrates a lot and is kinda annoying. What could i do to fix this?
  22. i was sleeping... Try this function for the login. Also, you might want to flush the table from all the "name" older usless entries. function playerLoggedIn() local derAccount = getPlayerAccount(source) local pname = getPlayerName(source) local pserial = getPlayerSerial(source) if (derAccount) then local query = dbQuery( connect, "SELECT * FROM drifttab WHERE spielername = '"..pserial.."';" ) local result, spaltenanzahl, errms = dbPoll(query,-1) if spaltenanzahl > 0 then for result,row in pairs(result) do driftbest = row["Best"] driftlast = row["Last"] drifttotal = row["Total"] end setElementData(getPlayerFromSerial(pserial), "Last Drift", driftlast) setElementData(getPlayerFromSerial(pserial), "Total Drift", drifttotal) setElementData(getPlayerFromSerial(pserial), "Best Drift", driftbest) outputChatBox("Drift Data Loaded.", source) else savepanelspalte=dbExec(connect, "INSERT INTO drifttab (spielername) VALUES (?)",pserial) setElementData(getPlayerFromSerial(pserial), "Last Drift", 3) setElementData(getPlayerFromSerial(pserial), "Total Drift", 3) setElementData(getPlayerFromSerial(pserial), "Best Drift", 3) local dq = dbExec( connect, "UPDATE drifttab SET Best=?,Last=?,Total=? WHERE spielername =? ",getElementData(getPlayerFromSerial(pserial), "Best Drift"),getElementData(getPlayerFromSerial(pserial), "Last Drift"),getElementData(getPlayerFromSerial(pserial), "Total Drift"),pserial) end end end addEventHandler("onPlayerLogin", getRootElement(), playerLoggedIn) Remove both dbFree, they're not needed (Neither with dbExec nor after dbPoll was called) Also, you use the function getPlayerFromSerial (Becouse you assume the source is not available there) But then you use the variable serial, wich is exactly the same as source there (It is even defined local)
  23. Perhaps this is what you need: isElementOnScreen Great, i'll use that then
  24. Bump, anyone? i thought of checking every sec and sending client a table, but that wouldnt be efficient at all...
  25. Thanks, I'll try that asap @Hypex The Element Data is correct, setElementData(element, key, value) and 3 is just the Drift score of souce Could you post the code after you changed the variable to serial? i cant find anything else wrong with the code
×
×
  • Create New...