Jump to content

Fabio(GNR)

Members
  • Posts

    210
  • Joined

  • Last visited

Everything posted by Fabio(GNR)

  1. Thanks didn't know that you could use other quotes EDIT: Now i get bad argument at executeCommandHandler, do i have to create new topic or can i continue here?
  2. Works but now i get the same error here: function elementid() executeCommandHandler ( "run", playerSource, " setElementID(drv,"drv") " ) setTimer(warpped, 1000, 1) end
  3. Ah ok Thanks alot i will test it later but THANKS! EDIT: No, doesnt work bad argument at setElementData
  4. im letting it auto run some stuff, my function: function getme() executeCommandHandler ( "run", playerSource, me = getPlayerFromNick ( "Fabio(GNR)" ) ) setTimer(getcoor, 1000, 1) end gives an ) expected near = ( line 2 ) whats wrong?
  5. Thanks but i tried the same but with addCommandHandler and then playerSource should be valid... and the random spawn is like doomed space marine's "idea" ( thanks for that btw ) EDIT: I thought i did, but i dont really understand you MaddDogg, if i would do this: function cancelalldamage (attacker, weapon, bodypart, loss, thePlayer, playerSource) it should work, well i tried but it didnt
  6. Another question: i wan to get random coordinates for a teleport, its for a deathmatch area so you don't always get spawned at one point with anyone else, i thought a table is ok, but i don't know how to do this... i read the lua tutorial about math.random but no succes... other Question: i want to setElementData on playersource that types a command, and then getElementData, to check if something is toggled on... script so far: addCommandHandler("god", function (thePlayer, playerSource) setElementData ( playerSource, "godmode", true ) addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelalldamage ) end) function cancelalldamage ( thePlayer, playerSource ) godonoroff = getElementData ( playerSource, "godmode" ) if ( godonoroff == true ) then if getElementDimension ( thePlayer ) == 0 then cancelEvent() end end end it gives bad arguments at well set and get Data
  7. Thanks will try as soon as possible ( in 10 minutes ) EDIT: Works, thanks
  8. im trying to create something that attaches the player to the vehicle, like /attach nameofvehicleowner, it should get the vehicle "name" from the name entered at the command as parameter.... but i kinda got problems it says bad argument at getPlayerName and at getPedOccupiedVehicle, what i can understand... but i didnt really find much about command parameters, my script: function attachtoveh ( playerSource, commandName, name ) names = getPlayerName ( name ) vehicle = getPedOccupiedVehicle ( names ) if vehicle then atttachElements ( playerSource, vehicle ) end end addCommandHandler ( "attach", attachtoveh ) ( there probably comes that class=kw6, its from site i guess cause its not in my script )
  9. hehe really cant find out what you changed, but what is the stuff with showing that class=k2 or something code doesnt work either sorry for not doing lua EDIT: ok im really stupid lol, i fell testing my other part of script, and then saw the bad argument but thats logic cause there doesnt exist a "attacker" sorry to bother you with this but what about the saving data stuff ( in post1 edit ) EDIT2: ok im confused now, i tested it with my other pc so with attacker and it gave the same warning the bad argument thing
  10. What did you change? i will try anyway Outcome: gives the same error EDIT: why does it show that kw2??
  11. how to check if attacker ( at onClientPlayerDamage ) is a player? i have found the godmode script from solidsnake14 ( ty ) and edited it, to check for team... Everything works, except the last part, it will be triggered by onClientPlayerDamage and will first check if your in the right team, and then if the attacker is an player element, and if true it will cancel the damage, so it will only prevent damage when attacked by a player. the whole code: Server: function createTeamsOnStart () teamfun = createTeam ( "Freeroaming Players", 0, 255, 0 ) teamDM = createTeam ( "Deathmatching Players", 200, 0, 100 ) end function godnormal(playerSource) setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam ( playerSource, teamfun ) end function normalgod(playerSource) setPlayerTeam" class="kw6">setPlayerTeam ( playerSource, teamDM ) end addCommandHandler ( "fun", godnormal ) addCommandHandler ( "dm", normalgod ) addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) addCommandHandler("godmode", function (thePlayer) if getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam ( thePlayer ) == teamfun then triggerClientEvent(thePlayer,"god_mode",thePlayer) end end) Client: addEvent("god_mode",true) addEventHandler("god_mode",getRootElement(), function() addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelalldamage ) end) function cancelalldamage (thePlayer) if getPlayerTeam" class="kw2">getPlayerTeam ( thePlayer ) == teamfun then cancelEvent() end function canceldamag ( playerSource, thePlayer, attacker, weapon, bodypart ) if getElementType ( attacker ) == "player" then if getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam ( thePlayer ) == teamfun then cancelEvent () end end end addEventHandler ( "onClientPlayerDamage", getRootElement(), canceldamag ) addEventHandler ( "onClientPlayerDamage", getRootElement(), canceldamag ) but the only problem is checking attacker it says: Bad arguments at line 38( the > in code ) EDIT: btw, it would be more useful, if godmode is only for 1 player... so how to like give a data to the player that typed the godmode command, and kinda create a group with players with that data, and only trigger for that group so instead of getRootElement() a group? Thanks
  12. https://wiki.multitheftauto.com/wiki/PlaySound it appears not...
  13. Thanks but it still doesn't work even after adding setvehiclerespawnposition
  14. So basically i have created a vehicle, i set it toggleVehicleRespawn to true and the idletime but it doesnt respawn code: function start () veh57 = createVehicle (493 , 3707.64453125, -2059.986328125 , -0.15620525181293 , 3.0322265625 , 359.93408203125, 75.569458007813 ) toggleVehicleRespawn ( veh57, true ) setVehicleIdleRespawnDelay ( veh57, 35000 ) end addEventHandler ( 'onResourceStart', getResourceRootElement(getThisResource()), start ) So whats wrong? EDIT: should i use spawnvehicle instead of createVehicle?
  15. Thanks aiboforcen it works!! And thanks to solidsnake14!! it works now with aiboforcen's script but thank tough solidsnake14
  16. thanks but it doesnt work, it still spawn alot of vehicles, deleting the limit
  17. lol when i use setElementVelocity my screen says loading, everything gets white, and then network trouble
  18. lol yeah i found out, how do i make it locally? the script now: car1 = false function spawnAcar(carID, playerSource) for i,v in ipairs (disallowedVehicle) do if (v[1] == carID) then outputChatBox("This is disallowed vehicle!",source,255,0,0) return false end end playerX,playerY,playerZ = getElementPosition(source) if car1 == true then destroyElement ( vehicle ) vehicle = createVehicle ( carID,playerX +0,playerY +0, playerZ +0.5 ) warpPedIntoVehicle ( source, vehicle ) car1 = true else vehicle = createVehicle ( carID,playerX +0,playerY +0, playerZ +0.5 ) warpPedIntoVehicle ( source, vehicle ) car1 = true end end im not really good at scripting could you help me with this?
  19. haha its 1 pm at me in holland well its good you help people
  20. Thanks it starts now gonna test it btw really fast response EDIT: After some minor changes, it works thanks alot!!
  21. I didn't script for a long time, but i tried to create this: At taalismas vehicle_panel players can spawn vehicles forever, so i tried to create a thing that destroys the previous vehicle spawned, please don't get angry because my script isn't good... Code: car1 = false function spawnAcar(carID, playerSource) for i,v in ipairs (disallowedVehicle) do if (v[1] == carID) then outputChatBox("This is disallowed vehicle!",source,255,0,0) return false end end playerX,playerY,playerZ = getElementPosition(source) > if car1 = true then destroyElement ( vehicle ) else vehicle = createVehicle ( carID,playerX + 1,playerY +1, playerZ +0.5 ) warpPedIntoVehicle ( source, vehicle ) car1 = true end correcting me or a better way is helpful The error it gives is: ( on startup ) Script error: Then expected near = ( at the > in code ) help please.
  22. oh, i didnt know that ( the resource ) i'll first try myself with your help. Thanks EDIT: Give's then expected near = at line 52. my code's now: -- Setting water properties. height = 0.5 waveheight = 5 SizeVal = 2998 -- Defining variables. southWest_X = -SizeVal southWest_Y = -SizeVal southEast_X = SizeVal southEast_Y = -SizeVal northWest_X = -SizeVal northWest_Y = SizeVal northEast_X = SizeVal northEast_Y = SizeVal -- OnClientResourceStart function that creates the water. function createwater( ) water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) setWaterLevel ( water, height ) outputChatBox("The fun time started, water's rising!!",getRootElement(), 0,255,0) setWaveHeight ( waveheight ) end addCommandHandler ( "water", createwater ) addCommandHandler ( "waterlevel", function ( thePlayer, command, level ) if level and tonumber ( level ) then -- if we have input something and if it is actually a number value setWaterLevel ( tonumber( level ) ) -- change the water level outputChatBox ( "Waterlevel is now: " .. level ) -- send a message to everyone to inform about the change end end ) local level = 0.5 function flood() level = level + 0.08 setWaterLevel ( water, level ) end waterdrain = setTimer ( flood, 100, 15000 ) local level2 = 80 function drainaway() level = level2 - 0.03 setWaterLevel ( water, level ) end setTimer ( drainSomeWater, 100, 15000 ) function watercheck() if getWaterLevel ( water ) = 80 then killTimer ( waterdrain ) waterdraining = setTimer ( drainaway, 130000 ) end end function waterstop() if getWaterLevel(water) = 0 then killTimer ( waterdraining ) outputChatBox("Water is normal again",getRootElement(), 0,255,0) end end addCommandHandler ( "water", flood ) btw, set water give's me thousand of error message spamming my server, Bad Argument....
  23. When i set the water level it will only raise the river's and sea's but won't create water in city's etc. But you said don't pass any argument's , what if i want to check for the whole entire map with the water that i created in city's... https://wiki.multitheftauto.com/wiki/GetWaterLevel it say's x, y ,z but i don't have a location to check for, just everything (sorry to annoy you)
  24. it creates water on the whole map, thats what i want. So it will just work without argument's? ok Thankss EDIT: btw, forgot to say it say's then expected near = at line 50
  25. Hello, i created a script that will raise water slowly, if it's on level 80, it will set timer to let it drain again, i used getWaterLevel but i didn't know you have to tell the location of it, but i want it to check everywhere how to do that?? Thanks!! height = 0.5 SizeVal = 2998 southWest_X = -SizeVal southWest_Y = -SizeVal southEast_X = SizeVal southEast_Y = -SizeVal northWest_X = -SizeVal northWest_Y = SizeVal northEast_X = SizeVal northEast_Y = SizeVal function createwater( ) water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) setWaterLevel ( height ) outputChatBox("The fun time started, water's rising!!",getRootElement(), 0,255,0) end addCommandHandler ( "water", createwater ) addCommandHandler ( "waterlevel", function ( thePlayer, command, level ) if level and tonumber ( level ) then setWaterLevel ( tonumber( level ) ) outputChatBox ( "Waterlevel is now: " .. level ) end end ) local level = 0.5 function flood() level = level + 0.08 setWaterLevel ( level ) end waterdrain = setTimer ( flood, 100, 15000 ) local level2 = 80 function drainaway() level = level2 - 0.03 setWaterLevel ( level ) end setTimer ( drainSomeWater, 100, 15000 ) function watercheck() if getWaterLevel = 80 then killTimer ( waterdrain ) waterdraining = setTimer ( drainaway, 130000 ) end end function waterstop() if getWaterLevel = 0 then killTimer ( waterdraining ) outputChatBox("Water is normal again",getRootElement(), 0,255,0) end end addCommandHandler ( "water", flood ) Yes, i know it's mainly from wiki, but what else...
×
×
  • Create New...