-
Posts
84 -
Joined
-
Last visited
Everything posted by pro-mos
-
Are v.Rank and v.Player valid strings? if not, use tostring()
-
getVehicleModel(theVehicle) you need to be inside the vehicle before using the command, it wont work if you're entering the vehicle.
-
can someone explain to me line #7, as i see it very often and i don't know how it works local message = table.concat ({ ... },"")
-
Your question is unclear and you've posted hell lots of code! maybe that's why you haven't got answers yet. anyway, i managed to write something: Client-side: function attachRedNeon () local theVehicle = getPedOccupiedVehicle(localPlayer) if theVehicle == false then return end local pedHaveItem137 local stuff = getAttachedElements(theVehicle) for i, v in ipairs(stuff) do local id = getElementModel(v) if id and id == 137 then pedHaveItem137 = true break end end if pedHaveItem137 then setElementData( localPlayer, "neon", idModel[1] ) outputChatBox("#00ff00Now your neon color is #ff0000Red", 255,255,255, true) triggerServerEvent ("detachNeon", getLocalPlayer(), theVehicle) triggerServerEvent ("attachNeon", getLocalPlayer(), theVehicle) pedHaveItem137 = nil end end bindKey("N", "down", attachRedNeon)
-
i built upon CodyL's code: function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) -- Only create projectile if we are inside a SWAT if(vehicle) and getVehicleModel(vehicle) == 601 then local x, y, z = getElementPosition(vehicle) createProjectile(vehicle, 19, x, y, z+1.7) end end function toggleDemControls(bool) toggleControl ( "vehicle_fire", bool ) toggleControl ( "vehicle_secondary_fire", bool) end function swatEnter (player) if player ~= localPlayer then return end local vehicle = getPedOccupiedVehicle(localPlayer) if getElementModel (vehicle) == 601 then toggleDemControls(false) bindKey("vehicle_fire", "down", shootProjectile) bindKey("vehicle_secondary_fire", "down", shootProjectile) end end addEventHandler ( "onClientVehicleEnter", root, swatEnter ) -- enable vehicle fire when player exits the SWAT, or when he dies -- so he can use hunter or anything else. function enableVehicleFireIfDead () if source ~= localPlayer then return end toggleDemControls(true) end function swatExit (player) if player ~= localPlayer then return end toggleDemControls(true) end addEventHandler ( "onClientVehicleExit", root, swatExit ) addEventHandler ( "onClientPlayerWasted", root, enableVehicleFireIfDead ) if you could make the rocket rotation change with the camera that would be a bonus.
-
thanks very much uncle vlad, #Rip_DDC
-
its missing few things like on mouse hover over button, and a function to change dxText, like "guiSetText"
-
How to get the coordinates of non streamable Vehicle?
pro-mos replied to KatastrofaS's topic in Scripting
If there's no clients connected then you dont need to setElementStreamable() So there is no point of making that server side only -
Where do i get a dx library ready to use? I've searched everywhere but cant seem to find anything. The dx library page on the wiki doesnt say much and its marked for deletition .. I need something with documents explaining how to use it.
-
How to get the coordinates of non streamable Vehicle?
pro-mos replied to KatastrofaS's topic in Scripting
Server local freight = createVehicle(537,2285,-1285,25.7) addEventHandler("onVehicleEnter",root, function(driver) triggerClientEvent(driver,"toclient",root,freight) end) addEvent("xyz",true) addEventHandler("xyz",root, function(x,y,z) outputChatBox(" " .. x .. " " .. y .. " " .. z ) end) setTimer(function() setTrainSpeed(freight,0.5) end,200,0) Client addEvent("toclient",true) addEventHandler("toclient",root, function(freight) setElementStreamable(freight,false) setTimer(function() triggerServerEvent("xyz",root,getElementPosition(freight)) end,300,0) end) this would spam the chat with the train position, no matter what car you enter and even when you exit the train -
download another toptimes script ..
-
i guess that race toptimes doesn't work with modern DM maps that has no checkpoints (markers).
-
add this line to acl.xml underneath inside admin group: <object name="user.yourNickname"></object>
-
How to get the coordinates of non streamable Vehicle?
pro-mos replied to KatastrofaS's topic in Scripting
triggerServerEvent ( event, theElement, positionX, positionY, posZ) and then use this server side addEvent("event") then make use of the position with an event handler.. -
again.. use "/debugscript 3" before clicking spawn, and post the errors if any
-
what errors you get in /debugscript 3 ?
-
it would look like this, and server sided, because you want other players to see your vehicle not only you. local pVehicles = {} function createVehicleForPlayer(source) if not pVehicles[source] then -- If the player doesnt have a vehicle, and source means whoever triggered the "onPlayerJoin" event local x,y,z = getElementPosition(source) -- get the player position vehicleCreated = createVehicle(model, x + 5, y, z + 0.5) -- Create a vehicle near the player if vehicleCreated then pVehicles[source] = true end else -- if the player has a vehicle already -- warp the player to the vehicle or do something else end end addEventHandler("onPlayerJoin", root, createVehicleForPlayer) note that when the script restarts the array would be lost, you better use a data base.
-
Thanks
-
well, your code is unclear, so add it before the code line that checks for text content, and dont forget to use end after the if statment
-
I know about the function getPlayerFromName but it requires to enter the full name of player. How can i get player name when i give the function only a part from name or a middle part in his name?
-
you can add this line if not text == "leave" then
-
thanks, didn't know i have to convert limit to a number..
-
its not that different from my code.. it only prints the first if statment, and never prints whats inside else "GO GO GO"