Mat101 Posted September 9, 2010 Share Posted September 9, 2010 Hello, I'm here agian, and i need your help guys, i created lots and lots of teleports, and they working fine but if the ped/player is in car it doesnt work, It says the message that i set example You have been teleported to .. but it doesnt teleport to pos if the player in the car Oh and i have another question , I just seen this on lots of server.. When a player join it show a image file.. Can someone do it for me? my folder of the pic is img\title.png Thanks for help Link to comment
dzek (varez) Posted September 9, 2010 Share Posted September 9, 2010 1.) You didnt give us your code. Read me 2.) No request here. GUI tutorial - it's easy. Link to comment
Mat101 Posted September 10, 2010 Author Share Posted September 10, 2010 Thanks varez for that GUI Tut Oh and here's the code sorry, this is one of my teleport function aa (source) setElementPosition ( source, 384.0750,2541.4612,16.5391) outputChatBox ( "You Have Been Teleported To The Old Airport!!", source, 0, 255, 0 ) end addCommandHandler ( "aa", aa ) Link to comment
Castillo Posted September 10, 2010 Share Posted September 10, 2010 Thanks varez for that GUI TutOh and here's the code sorry, this is one of my teleport function aa (source) setElementPosition ( source, 384.0750,2541.4612,16.5391) outputChatBox ( "You Have Been Teleported To The Old Airport!!", source, 0, 255, 0 ) end addCommandHandler ( "aa", aa ) you got totally wrong, first you need to do getPedOccupiedVehicle then you can teleport it etc, here is the code done and working function aa (source) local vehicle = getPedOccupiedVehicle(source) if vehicle then setElementVelocity(vehicle,0,0,0) setElementPosition ( vehicle, 384.0750,2541.4612,16.5391) outputChatBox ( "You Have Been Teleported To The Old Airport!!", source, 0, 255, 0 ) end end addCommandHandler ( "aa", aa ) Link to comment
dzek (varez) Posted September 10, 2010 Share Posted September 10, 2010 do not name your variables as "source" and Solid's script will only teleport if you are in car. fixed version function aa (playerSource) local vehicle = getPedOccupiedVehicle(playerSource) if vehicle then setElementVelocity(vehicle,0,0,0) setElementPosition (vehicle, 384.0750,2541.4612,16.5391) else setElementPosition (playerSource, 384.0750,2541.4612,16.5391) end outputChatBox ("You Have Been Teleported To The Old Airport!!", playerSource, 0, 255, 0) end addCommandHandler ( "aa", aa ) Link to comment
Mat101 Posted September 10, 2010 Author Share Posted September 10, 2010 A Problem... When i teleport with a car, The car goes fast as hell.. Someone know how to fix it? Link to comment
dzek (varez) Posted September 10, 2010 Share Posted September 10, 2010 fast? in which direction? maybe target position is too low (and car is teleported partially in the ground - which makes it kick out of there) Link to comment
Wojak Posted September 10, 2010 Share Posted September 10, 2010 setElementVelocity(vehicle,0,0,0) should go after setElementPosition (vehicle, 384.0750,2541.4612,16.5391) or: function aa (playerSource) local vehicle = getPedOccupiedVehicle(playerSource) if vehicle then setVehicleFrozen(vehicle,true) setElementPosition (vehicle, 384.0750,2541.4612,16.5391) setTimer(setVehicleFrozen,50,1,vehicle,false) else setElementPosition (playerSource, 384.0750,2541.4612,16.5391) end outputChatBox ("You Have Been Teleported To The Old Airport!!", playerSource, 0, 255, 0) end addCommandHandler ( "aa", aa ) if there is no syntax error Link to comment
dzek (varez) Posted September 10, 2010 Share Posted September 10, 2010 Wojak - you are not unfrozing the vehicle anywhere.. And changing order of setting position/velocity won't help i think - its almost the same Link to comment
DiSaMe Posted September 10, 2010 Share Posted September 10, 2010 do not name your variables as "source" It's fine to name variables "source", as long as function isn't attached to any event. I always use "source" as a variable name for the player element in command functions and that doesn't cause any problems. Link to comment
50p Posted September 10, 2010 Share Posted September 10, 2010 do not name your variables as "source" It's fine to name variables "source", as long as function isn't attached to any event. I always use "source" as a variable name for the player element in command functions and that doesn't cause any problems. Only commands and the functions a handler calls can have source as parameter, although if the function is called from a function that is called by an event it will still pass source in. addEventHandler( "onPlayerJoin", getRootElement(), function( ) playerJoined( ); end ) function playerJoined( ) -- notice the source is not a parameter but it's still passed here outputChatBox( getPlayerName( source ) .. " joined the server." ); end I strongly do NOT recommend using source as parameter because if you can easily forget about the difference between command handlers and event handlers.. Or you may want tu use same function for a command and an event. Wojak - you are not unfrozing the vehicle anywhere..... He is... setTimer(setVehicleFrozen,50,1,vehicle,false) But the interval is too short. You should keep the vehicle frozen until collision is fully loaded. You can check if collision has loaded with processLineOfSight in client-side script but if you think it'll be too complicated for you to make, then use higher interval value like 1000. Link to comment
Mat101 Posted September 10, 2010 Author Share Posted September 10, 2010 setElementVelocity(vehicle,0,0,0) should go after setElementPosition (vehicle, 384.0750,2541.4612,16.5391) or: function aa (playerSource) local vehicle = getPedOccupiedVehicle(playerSource) if vehicle then setVehicleFrozen(vehicle,true) setElementPosition (vehicle, 384.0750,2541.4612,16.5391) setTimer(setVehicleFrozen,50,1,vehicle,false) else setElementPosition (playerSource, 384.0750,2541.4612,16.5391) end outputChatBox ("You Have Been Teleported To The Old Airport!!", playerSource, 0, 255, 0) end addCommandHandler ( "aa", aa ) if there is no syntax error Ok Thanks it works but **** keep's comming, Now the teleport works only on /aa .. i do lots of teleports but none of them works only /aa .. Link to comment
50p Posted September 10, 2010 Share Posted September 10, 2010 ...Ok Thanks it works but **** keep's comming, Now the teleport works only on /aa .. i do lots of teleports but none of them works only /aa .. You're doing something wrong.. that's why. Link to comment
Mat101 Posted September 10, 2010 Author Share Posted September 10, 2010 ...Ok Thanks it works but **** keep's comming, Now the teleport works only on /aa .. i do lots of teleports but none of them works only /aa .. You're doing something wrong.. that's why. Like what? Should i post one of the teleport that is not working? Link to comment
50p Posted September 10, 2010 Share Posted September 10, 2010 ...Ok Thanks it works but **** keep's comming, Now the teleport works only on /aa .. i do lots of teleports but none of them works only /aa .. You're doing something wrong.. that's why. Like what? Should i post one of the teleport that is not working? Of course... How do you expect us to know your code? Link to comment
Mat101 Posted September 10, 2010 Author Share Posted September 10, 2010 function aa (playerSource) local vehicle = getPedOccupiedVehicle(playerSource) if vehicle then setVehicleFrozen(vehicle,true) setElementPosition (vehicle, 384.0750,2541.4612,16.5391) setTimer(setVehicleFrozen,500,1,vehicle,false) else setElementPosition (playerSource, 384.0750,2541.4612,16.5391) end outputChatBox ("You Have Been Teleported To The Old Airport!!", playerSource, 0, 255, 0) end addCommandHandler ( "aa", aa ) ---- This Command above works fine... Now this doesnt work see function sf (source) local vehicle = getPedOccupiedVehicle(playerSource) if vehicle then setVehicleFrozen(vehicle,true) setElementPosition (vehicle, -2621.7676,1396.3899,7.1016) setTimer(setVehicleFrozen,500,1,vehicle,false) else setElementPosition (playerSource, -2621.7676,1396.3899,7.1016) end outputChatBox ("You Have Been Teleported To San Fierro!!", playerSource, 0, 255, 0) end addCommandHandler ( "sf", sf ) Edit : By the way im getting those warnings in the console [2010-09-10 13:55:26] WARNING: play\broph.lua:115: Bad argument @ 'getPedOccupiedVehicle'[2010-09-10 13:55:26] WARNING: play\broph.lua:121: Bad argument @ 'setElementPosition' [2010-09-10 13:55:28] WARNING: play\broph.lua:115: Bad argument @ 'getPedOccupiedVehicle' [2010-09-10 13:55:28] WARNING: play\broph.lua:121: Bad argument @ 'setElementPosition' [2010-09-10 13:55:32] WARNING: play\broph.lua:115: Bad argument @ 'getPedOccupiedVehicle' [2010-09-10 13:55:32] WARNING: play\broph.lua:121: Bad argument @ 'setElementPosition' [2010-09-10 13:55:34] WARNING: play\broph.lua:115: Bad argument @ 'getPedOccupiedVehicle' [2010-09-10 13:55:34] WARNING: play\broph.lua:121: Bad argument @ 'setElementPosition' [2010-09-10 13:55:39] CHAT: Mat101: sf [2010-09-10 13:55:40] WARNING: play\broph.lua:115: Bad argument @ 'getPedOccupiedVehicle' [2010-09-10 13:55:40] WARNING: play\broph.lua:121: Bad argument @ 'setElementPosition' [2010-09-10 13:55:45] QUIT: Mat101 left the game [Quit] P.S Im editing broph.. Link to comment
Wojak Posted September 10, 2010 Share Posted September 10, 2010 function sf (source) this is the wrong line, you should reed the whole topic once more, learn something and try to fix it yourself... Link to comment
Mat101 Posted September 10, 2010 Author Share Posted September 10, 2010 function sf (source) this is the wrong line, you should reed the whole topic once more, learn something and try to fix it yourself... Lol let me try it .. Thanks for the info (((: Edit, It Work's perefectly! Thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now