
kuwalda
Members-
Posts
92 -
Joined
-
Last visited
Everything posted by kuwalda
-
Nevermind, fixed it by myself Okey, so I have this table which stores all my objects and some aditional info. Table info stored like this (shortened for better understanding): SafeHouseGarageV1 = { } SafeHouseGarageV1["info"] = { .., .., .. } SafeHouseGarageV1[1] = createObject(..) SafeHouseGarageV1[2] = createObject(..) SafeHouseGarageV1[3] = createObject(..) I have script, where I need to find which checkpoint player hit. After script have found it out, I replace that long code with variable. And my problem is - how can I create those objects using "for" loop? I have tried to do it countless times, still failing. My code (shortened for better understanding): local garage = _G[getElementData(source, "representingGarage")] if garage and type(garage) == 'table' then for id, object in pairs(garage) do setElementDimension(_G[object], representingGarageID) end return id, object end Any help would be appriciated, because this is driving me crazy, for countless attempts to fix it. EDIT: I found out example in forums and it looked like this: local tMarkers = { { nX = 0, nY = 0, nZ = 10 }; { nX = 200, nY = 200, nZ = 20 }; } for _, t in pairs( tMarkers ) do createMarker ( t.nX, t.nY, t.nZ ) end How can I just make this example work, without those nX,nY,nZ prefixes?
-
I have strange problem. I have marker that represents point to enter garage. When player enter these garage they see each other and stack up, so basiclly players can see each other (car/player model). But when player exit this garage, this player is "invisible". Everyone can see their nametags and HP, but not their model, nether their car. This player can hurt everyone else, but only this others can see is their nametag. Can someone please help me? My code: --this gets player into garage (code shortened) addEventHandler( "onMarkerHit", createMarker ( 220.9228515625, 17, -4, "cylinder", 7, 63, 165, 14, 165 ), function(thePlayer) if getPedOccupiedVehicle ( thePlayer ) then setElementInterior(thePlayer, 18, 1292.6689453125 ,-54.3330078125 ,1002.2244873047 ) setElementInterior(getPedOccupiedVehicle(thePlayer), 18, 1292.6689453125 ,-54.3330078125 ,1002.2244873047 ) triggerClientEvent(thePlayer, "requestShowPlayerGarageGUI", thePlayer) end end) --and this gets him out addEventHandler('onClientGUIClick', getRootElement(), function(button, state, absoluteX, absoluteY) if(source == PamestGarazuJa)then if(button == 'left') then setElementInterior(localPlayer, 0, 224.0419921875, 26.998046875, 2.298052072525) setElementInterior(getPedOccupiedVehicle(localPlayer), 0, 224.0419921875, 26.998046875, 2.298052072525) setElementRotation(getPedOccupiedVehicle(localPlayer), 359.96508789063 ,359.9765625 ,317.404296875) setCameraTarget( localPlayer, localPlayer ) end end end)
-
Okey, I got actually pretty far so far! The only thing that I can`t manage to find out - how did he scroll/move trought that menu? How to make it? ( )
-
There is no need to, because this script works, but only this line bothers me. Instead of: if tonumber(getElementModel(thePlayer)) ~= (tonumber(organizacijuSkinList["teamMehanic"][1]) or tonumber(organizacijuSkinList["teamMehanic"][2])) then I could have used: if tonumber(getElementModel(thePlayer)) ~= (tonumber(organizacijuSkinList["teamMehanic"][1]) then if tonumber(getElementModel(thePlayer)) ~= tonumber(organizacijuSkinList["teamMehanic"][2])) then But it feels wrong to me and I wanted to found out, how can I do it corectlly.
-
organizacijuSkinList["teamPolice"] = { 280, 281 } if tonumber(getElementModel(thePlayer)) ~= (tonumber(organizacijuSkinList["teamPolice"][1]) or tonumber(organizacijuSkinList["teamPolice"][2])) then I am storing my organisations skin lists in table like shown above. Problem is that my if statement works only for first check. Like in simplified version, lets say player got skin 311 if 311 ~= 312 or 241 This check works only for first value (311 ~= 312), but it ignores second check (241). Why?
-
Hello. I found a 2 year old video of some Poland server where I really liked the garage he used, so I was thinking about making something simullar. The video is here - .The guy enters that garage an that interior and those menu styles is what I wanted to make, but I only kinda understud how did he made it. So I am asking for your help and advices which functions to use and a simple plan how to make it.I made some little plan myself, but I am not 100% sure if that would work: [*]Player enters colshape and GUI pops out asking to setElementInterior him My question is: which interior should I use? Or should I just map it myself? [*]To make that inside garage look - setElementFrozen and setCameraMatrix? Am I right? And my biggest shame spot is that I have no idea how to make that bottom menu. For those side "handling", "top speed" and "acceleration" thingys he probobly used GUI progress bars, but how did he made that bottom part where you switch car parts? Which functions should I use for that? And how to make those custom icons? I know I have to cut them out from somewhere and make them .png and then add them in meta.xml file, but what next? I hope someone understanded what I tried to say and can share some advices.
-
Is it possible to make players carry around boxes or other objects in their hands? Like for example player is at job mission and he have to take rocks or boxes, holding them in both arms, and bring them from pointX to pointY.
-
Hello. I am trying to make this function working for me, but I can`t make it. function orgInvite(thePlayer, command, invitedPlayer) if getPlayerTeam(thePlayer) then if tonumber(getElementData( thePlayer, "org_rank" )) >= 2 then setElementData( getPlayerFromName(invitedPlayer), "org_invited", getTeamName(getPlayerTeam(thePlayer)) ) outputChatBox("GJ, you have been invited to:"..getElementData( thePlayer, "org_invited" ).."",getPlayerFromName(invitedPlayer), 0, 255, 0 ) end end end addCommandHandler("invite", orgInvite) Everything works for the guy who typed /invite, but nothing works for invitedPlayer. Why and how to fix it?
-
Nevermind, got it all working by adding if getElementType(player) == "player" then Thanks everyone for help!
-
Ohh, I got it. I have traffic resource going on for me around the map and probbobly those peds are driving with those cars. Is there a way to apply this check only for "real" players/peds?
-
Ok, thanks for help, but why do both of these scripts give me out Bad 'player' pointer @ 'getPlayerTeam'(1) Bad argument @ 'getTeamName'
-
Can someone please show me brief example on how to createVehicle and then apply on it rule, that only specific team can gain access to it? I had an idea like: car1 = createVehicle ( 540, x, y, z ) car2 = createVehicle ( 540, x, y, z ) car3 = createVehicle ( 540, x, y, z ) function enterVehicle ( thePlayer, seat, jacked ) if car1 or car2 or car3 and getTeamName ~= "myTeam" then --kick him out of the car end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) but is this basiclly the only way? I would like better that those cars are locked and only "myTeam" can open the doors and drive normally with them. Is this possible or I have to use something like I mentioned above? Or maybe someone have better solution or advice?
-
Is it possible to add up two files? Like I have my checkpoints stored in tables and they take up way too many lines. Is it somehow possieble that I put all those tables in seperate file and use something like, in php function include? Or is there any other way?
-
And what I am missing in here: setMarkerIcon(getElementData(thePlayer, "checkpoints"), "finish")
-
I have a small part of my code here: setElementData(thePlayer, "checkpoints", createMarker(_G[""..getElementData( thePlayer, "raceParticipate" )..""][ciga][1], _G[""..getElementData( thePlayer, "raceParticipate" )..""][ciga][2], _G[""..getElementData( thePlayer, "raceParticipate" )..""][ciga][3], "checkpoint", 6, 190, 156, 252, 250)) --works setElementData(thePlayer, "blips", createBlip( _G[""..getElementData( thePlayer, "raceParticipate" )..""][ciga][1], _G[""..getElementData( thePlayer, "raceParticipate" )..""][ciga][2], _G[""..getElementData( thePlayer, "raceParticipate" )..""][ciga][3], 0, 3, 190, 156, 252, thePlayer)) --works setMarkerIcon(getElementData(thePlayer, "checkpoints"), "finish") -- do not work setElementVisibleTo(getElementData(thePlayer, "checkpoints"), root, false) --works setElementVisibleTo(getElementData(thePlayer, "blips"), root, false) --works setElementVisibleTo(getElementData(thePlayer, "checkpoints"), thePlayer, true) --works setElementVisibleTo(getElementData(thePlayer, "blips"), thePlayer, true) --works setElementDimension( getElementData(thePlayer, "checkpoints"), 1 ) --works setElementDimension( getElementData(thePlayer, "blips"), 1 ) --works Why setMarkerIcon line does not work for me?
-
Silly question, but how can I use this function to get those returned values? function findRaceWinner(raceToEnd) if blueBerryRallyP and type(blueBerryRallyP) == 'table' then local time, winner = math.huge for thePlayer, theTime in pairs(blueBerryRallyP) do if theTime < time then winner, time = thePlayer, theTime end end return winner, time end return false end Like how can I get or use those return winner, time values after calling function setTimer ( findRaceWinner, 240000, 1, raceMap )
-
Yes, it worked now. Silly question, but how can I use this function to get those returned values? function findRaceWinner(raceToEnd) if blueBerryRallyP and type(blueBerryRallyP) == 'table' then local time, winner = math.huge for thePlayer, theTime in pairs(blueBerryRallyP) do if theTime < time then winner, time = thePlayer, theTime end end return winner, time end return false end Like how can I get or use those return winner, time values?
-
If I am storing players name and race time like this in table: blueBerryRallyP[thePlayer] = ((getTickCount () - getElementData( thePlayer, "laiks" )) / 1000) Why does this not work: function endRace(raceToEnd) outputChatBox("Ending:"..raceToEnd..".", root, 0, 255, 255) function findRaceWinner(blueBerryRallyP) if blueBerryRallyP and type(blueBerryRallyP) == 'table' then local time, winner = math.huge for thePlayer, theTime in pairs(blueBerryRallyP) do outputChatBox("INDEX "..thePlayer..", ar VALUE: "..theTime ) if theTime < time then winner, time = thePlayer, theTime end end return winner, time end return false end end It just shows outputChatBox("Ending:"..raceToEnd..".", root, 0, 255, 255) line and thats all.
-
http://oi48.tinypic.com/suvpra.jpg
-
function endRace(raceToEnd) outputChatBox("We would end this race:"..raceToEnd..".", root, 0, 255, 255) --this shows, but nothing more function findRaceWinner(blueBerryRallyP) if blueBerryRallyP and type(blueBerryRallyP) == 'table' then local time, winner = math.huge for thePlayer, theTime in pairs(blueBerryRallyP) do if theTime < time then winner, time = thePlayer, theTime outputChatBox("TEST: "..winner.."", root, 0, 255, 255) outputChatBox("TEST: "..time.."", root, 0, 255, 255) outputChatBox("TEST: "..tostring(winner).."", root, 0, 255, 255) outputChatBox("TEST: "..tostring(time).."", root, 0, 255, 255) end end return winner, time end return false end end why this is not working, when this is: function sexyinfo(thePlayer, command) outputChatBox(""..tostring(blueBerryRallyP[thePlayer]).."", thePlayer, 255, 255, 0) end addCommandHandler("fancy", sexyinfo)
-
Hello. I kinda bad with tables, so I don`t know how to correctly write them, but I hope you will understand my problem. First of all I want to store all players, that have accepted their participation into race, into table: raceName[playername] = unfinished or finishtime And after, when my timer ticks out, I want to call function on all of those players: setTimer ( endRace, 10000, 1, raceMap ) function endRace(raceToEnd) outputChatBox("Lets end this map:"..raceToEnd.."", root, 0, 255, 255) --run loop for every player in table --*arguments to end race* --end loop end So what I am asking - how to make this loop? I know it`s something like for x,y in pairs(table) do ,but I don`t really understand how it works. I would be really greatful to anyone who could type this loop for me and explain it for me, so I know how to use it next time. Also, I am having question - I have function function raceConsider( ) if getPlayerCount() >= 1 and raceActive["aktivs"] == false then raceActive["aktivs"] = true setTimer ( needRaceGUI, 5000, 1) outputChatBox("DEBUG:[1]", root, 255, 255, 0) end end addEventHandler ( "onPlayerJoin", getRootElement(), raceConsider ) addCommandHandler("gorace", raceConsider) I can active it by joining the server, or typing command /gorace. How can I determinate what activated this function and if it was activated by command, I want to skip that IF statement check. Is it possible or I have to type another function?
-
Is it possible to remove vehicle hood, bumper, doors and other parts? I know you can remove them if they are upgraded (like spoilers and stuff), but is it possible to remove cars doors, if they are stock?
-
Why does if isElementWithinMarker(thePlayer, getElementData(thePlayer, "checkpoints")) or isElementWithinMarker(getPedOccupiedVehicle(thePlayer), getElementData(thePlayer, "checkpoints")) then gives me out Bad argument @ 'destroyElement' [Expected element at argument 1, got boolean]
-
up? still can`t find a fix.