Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. Because you created the vehicle in client-side, you have to create it in server-side.
  2. Hi dolmen62, I'm french too and I wanted to know what sort of gamemode do you making ? An RPG, or something else ? There more Frenches on MTA evry months, and it's very cool 'cause sa:mp sucks and they stealing the MTA scripters --' EDIT: Code fixed works only 1 time ( tips: createMarker or createColShape at every stations then use onMarkerHit or onColShapeHit ) function makeTrain(source) loco = createVehicle(537,1725.9,-1954,16) locool = createVehicle(538,1840,-1954,16) setTrainDerailable(loco, false) setTrainDerailable(locool, false) local pilot1 = createPed(241,1693.38,-1959,15.6) local pilot2 = createPed(241,1711,-1959,15.6) warpPedIntoVehicle (pilot1, loco) warpPedIntoVehicle (pilot2, locool) setTrainSpeed(loco, 0) setTrainSpeed(locool,0.21) -- why 0.21 ? outputChatBox("Train is here", source, 255, 255, 0) setTimer(stop, 10000, 1, source) setTimer(depart, 20000, 1, source) end addCommandHandler("traintest", makeTrain) function stop (source) setTrainSpeed(locool, 0) setTrainSpeed(locool, 0) outputChatBox("Le Train est en gare", source, 255, 255, 0) end function depart (source) setTrainSpeed(loco, 0.5) setTrainSpeed(locool, 0.5) end
  3. Yeah I made that if my car have a consomation of 8 L/100Km it's only if you stay at 50Km/h
  4. Personnaly I use a squarre function ( i.e: speed^2 ) but then you have to reduce it with / ( ie : (speed^2)/60 ) and change 60 and make test until you think that's a good fuel decrease. ( My system use the consomation of the vehicules ie: 3 L/100Km )
  5. There aren't any function to do that I use invisible peds ( excepted the driver ) and all peds do the same things at the same time. It's not the most safe way ( due to the sync ) I know but it's the easier way that I found Maybe I can use getDistanceBetweenPoints3D and make a setElementVelocity to keep the trailers at the good distance.
  6. Check my video => here ; )
  7. Those ideas aren't used ? Or we replaced useless object ? If those ideas aren't used by GTA, so you can add new objects ?
  8. No because the this is only for player ( that's why it's in the Player events category and it's name is onPlayerContact )
  9. Citizen

    Problems

    Because you have to stop copy the wiki and paste it whithout your brain leftseat is not defined in your code and it's come from the wiki exemple GetVehicleEngineState addEvent ( "bindKeys",true ) addEventHandler ( "bindKeys", getRootElement(), function() -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do if player == source then bindKey ( "f", "down", engineOffOn ) bindKey( "l", "down", changeLightsState ) end end end ) addEvent ( "unbindKeys",true ) addEventHandler ( "unbindKeys", getRootElement(), function() -- Initilize Player Element Data local players = getElementsByType ( "player" ) for k,p in ipairs(players) do if player == source then unbindKey ( "f", "down", engineOffOn ) unbindKey( "l", "down", changeLightsState ) end end end ) function engineOffOn() local vehicle = getPedOccupiedVehicle( source ) if ( getVehicleEngineState ( theVehicle ) ~= false ) setVehicleEngineState ( vehicle, false ) else setVehicleEngineState ( vehicle, true ) end end function changeLightsState() local vehicle = getPedOccupiedVehicle( source ) if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then setVehicleOverrideLights( vehicle, 2 ) else setVehicleOverrideLights( vehicle, 1 ) end end
  10. Citizen

    Y Assix

    Yeah, see the wiki it's in exemple: local lines = getChatboxLayout()["chat_lines"]
  11. I fixed the SolidSnake's code: -- your 3 lines: fadeCamera(false,1) TimerChange = setTimer(changeLocation,1000,0, ) setTimer(fadeCamera,1000,1,true) --------------------- local myLocationsTable = { {x, y, z, x2, y2, z2}, -- specify the position of the camera ( x, y, z ) and the point that the camera look at ( x2, y2, z2 ) {x, y, z, x2, y2, z2}, {x, y, z, x2, y2, z2}, {x, y, z, x2, y2, z2} } function changeLocation(player) local cx, cy, cz, px, py, pz = getRandomLocation() setCameraMatrix( cx, cy, cz, px, py, pz ) end function getRandomLocation() local rand = math.random(#myLocationsTable) local x, y, z, x2, y2, z2 = myLocationsTable[rand][1], myLocationsTable[rand][2], myLocationsTable[rand][3], myLocationsTable[rand][4], myLocationsTable[rand][5], myLocationsTable[rand][6] return x, y, z, x2, y2, z2 end -- When the player is logged: killTimer( TimerChange ) EDIT: Fixed
  12. Citizen

    Y Assix

    No problem but some players change de size of their chatbox so maybe you can use getChatboxLayout to get the size of the chatbox's player and set it to y It just a suggestion
  13. Citizen

    Y Assix

    local y = 200 function onTriggerAdd(pos, toIns) table.insert(players, toIns) y = y + 8 end addEvent("onAddRequest", true) addEventHandler("onAddRequest", getRootElement(), onTriggerAdd) function onRender() local text = 0 for _,item in ipairs(players) do dxDrawColorText(item, 15, y-text , 15, y-text ,tocolor(255,255,255), 0.35, "bankgothic", "left", "center", false, false, false) text = text+8 end end addEventHandler("onClientRender", getRootElement(), onRender)
  14. Citizen

    Y Assix

    humm maybe this ?: function onRender() -- local text = 1 local y = 200 for _,item in ipairs(players) do dxDrawColorText(item, 15, 16-y, 15, 16-8,tocolor(255,255,255), 0.35, "bankgothic", "left", "center",false, false, false) -- text = text + 1 y = y + 8 end end addEventHandler("onClientRender", getRootElement(), onRender)
  15. Maybe try this: local accounts = {} local oldAccount = getPlayerAccount(src) local password = getAccountData(oldAccount, 'password') accounts[src] = addAccount(newnick, password) copyAccountData(accounts[src], oldAccount ) removeAccount(oldAccount)
  16. Haha yeah I recognized my script immediately when I saw it and then I saw your credit thx dxDrawText works with absolutes arguments so you have to convert relatives arguments to absolutes arguments like laserlaser made. But something is strange, why do you have to use it ? because it's useless ! => why do you convert absolute args to relatives args and then go back to absolutes args, just take directly the absolute args. IDK if you see what I mean ...
  17. Yeah ok and replace the createProjectile's line by this one: createProjectile ( sourceP, 20, 16, 16, 30, 1, targetPlayer) I think it's what he wanted but if there are an obstacle between 16, 16, 30 and the position of the targeted player, the projectile will crash on it. So maybe this: createProjectile ( sourceP, 20, x, y, z+30, 1, targetPlayer)
  18. or this: setTimer(addAlpha, 50, 80, infoWindow) -- 0 => 255 in 4 sec ( 50*80 = 4000 ms = 4 sec ) function addAlpha( element ) local alpha = guiGetAlpha( element ) guiSetAlpha( element, alpha+(255/80) ) end
  19. As far I know we can compare 2 strings. I mean for exemple this: if "a" < "b" then outputChatBox( "Yeah a it's lower than b !!" ) end And I think that you can make it for numbers, because it's compare the ASCII code. (If I'm wrong, tell me ) But yeah tonumber it's better. If I understand correctly, the player have to play more than 3 hours before than he can killed by someone It's a spawn protect for 3 hours
  20. Hi, Try this ( not tested ): Server: function granate (thePlayer, commandName, ...) local player = findPlayer(...) if not player then outputChatBox("* /givegran: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) local x, y, z = getElementPosition ( vehicle ) local rx, ry, rz = getVehicleRotation ( vehicle ) local shark = createObject ( 1608, x, y, z, rx, ry, rz ) attachElements ( shark, vehicle, 0, -3.5, 0, 0, 0, 0) setElementAlpha(vehicle, 0) setElementAlpha(player, 0) triggerClientEvent (player, "shark_key", getRootElement ()) end end addCommandHandler("givegran", granate) Client: addEvent ("shark_key", true) function fire_rocket () -- is it a rocket or a grenade ??? local x, y, z = getElementPosition (getPedOccupiedVehicle (getLocalPlayer())) local rx, ry, rz = getElementRotation(getPedOccupiedVehicle (getLocalPlayer())) createProjectile ( getLocalPlayer(), 16, x, y, z + 1, 1.0, 0, rx, ry, rz) end function bind_key_function () bindKey ("mouse2", "down", fire_rocket) local attachedElements = getAttachedElements ( getPedOccupiedVehicle (getLocalPlayer()) ) for ElementKey, ElementValue in ipairs ( attachedElements ) do setElementCollisionsEnabled (ElementValue, false) end end addEventHandler ("shark_key", getLocalPlayer(), bind_key_function)
  21. Citizen

    Gm image

    Just say us with what resolution the position is perfect, and I can make it Ok so I think you was in 800*600 so try this: local xx, yy = relativeToAbsolute(0.875,0.1) local sxx, syy = relativeToAbsolute(0.045,0.0583) dxDrawImage (xx,yy,sxx,syy,getElementData(localP,"overrideCollide.uniqueblah") and "ghostmodeon.png" or "ghostmodeoff.png") function relativeToAbsolute(x, y) local screenX, screenY = guiGetScreenSize() local X = x*screenX local Y = y*screenY return X, Y end
  22. Citizen

    Gm image

    Just say us with what resolution the position is perfect, and I can make it
  23. I knew that you are not a big poster of personnal issues
  24. Lol it's just a forum bug, when you want to show setPlayerTeam in lua syntax. I saw your script quickly and I don't find any error. I'll test it soon.
  25. Mmm and your interior id is good ? I mean that if you set the bad interior, you will fall through this interior ( and you can't see it ). If you see the interior but you fall through it, so do what Oz said.
×
×
  • Create New...