-.Paradox.- Posted April 20, 2014 Posted April 20, 2014 Hello, I made a warp panel , but when i click warp, i'm not warped to the selected player, No errors in debugscript 3, hope somebody help me with this. Thanks Server; addEvent("warp", true) addEventHandler("warp", root, function (source, playername) local player = getPlayerFromName(playername or "") if player then --local x,y,z = getElementPosition(player) if ( isPedInVehicle(player) ) then local playerVehicle = getPedOccupiedVehicle ( player ) local numseats = getVehicleMaxPassengers ( playerVehicle ) local i = 0 while ( i < numseats ) do if ( getVehicleOccupant ( playerVehicle, i ) ) then i = i + 1 else break end end if ( i < numseats ) then warpPedIntoVehicle ( source, playerVehicle, i ) else outputChatBox ( "Sorry, the player's vehicle is full (" .. getVehicleName ( playerVehicle ) .. " " .. i .. "/" .. numseats .. ")", source ) end else x, y, z = getElementPosition ( player ) r = getPedRotation ( player ) interior = getElementInterior ( player ) dimension = getElementDimension ( player ) x = x - ( ( math.cos ( math.rad ( r + 90 ) ) ) * d ) y = y - ( ( math.sin ( math.rad ( r + 90 ) ) ) * d ) setTimer ( setElementInterior, 800, 1, source, interior ) setTimer ( setElementDimension, 900, 1, source, dimension ) setTimer ( setElementPosition, 1000, 1, source, x, y, z ) setTimer ( setPedRotation, 1000, 1, source, r ) fadeCamera ( source, false, 1, 0, 0, 0 ) setTimer ( fadeCamera, 1000, 1, source, true, 1 ) --setElementPosition(source, x,y,z) end end end) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted April 20, 2014 Posted April 20, 2014 Post how you trigger "warp". San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted April 20, 2014 Author Posted April 20, 2014 addEventHandler("onClientGUIClick", guiRoot, function() if source == warpPanel.button[2] then local row, column = guiGridListGetSelectedItem(warpPanel.gridlist[1]) if row == -1 then return end local playerName = guiGridListGetItemText(warpPanel.gridlist[1],row,column) local player = getPlayerFromName(playerName) if not playerName then guiGridListRemoveRow(row) return end triggerServerEvent("warp", player,playerName) end end) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Castillo Posted April 20, 2014 Posted April 20, 2014 -- server side: function (source, playername) Remove 'source' from there. -- client side: Change: triggerServerEvent("warp", player,playerName) To: triggerServerEvent ( "warp", localPlayer, playerName ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted May 2, 2014 Author Posted May 2, 2014 :28:attempt to perform arithmetic on global 'd' (a nil value) :29:attempt to perform arithmetic on global 'd' (a nil value) If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted May 3, 2014 Author Posted May 3, 2014 I have rewrite the whole code, here is it; addEvent("warp", true) addEventHandler("warp", root, function (sourcePlayer, _, playername) if ( not sourcePlayer or not playername ) then return end local x, y, z, r, d = 0, 0, 0, 0, 2.5 local player = getPlayerFromNick ( playername ) if ( player ) then if ( isPlayerInVehicle ( player ) ) then local playervehicle = getPlayerOccupiedVehicle ( player ) local numseats = getVehicleMaxPassengers ( playervehicle ) local i = 0 while ( i < numseats ) do if ( getVehicleOccupant ( playervehicle, i ) ) then i = i + 1 else break end end if ( i < numseats ) then warpPlayerIntoVehicle ( sourcePlayer, playervehicle, i ) else outputChatBox ( "Sorry, the player's vehicle is full (" .. getVehicleName ( playervehicle ) .. " " .. i .. "/" .. numseats .. ")", sourcePlayer ) end else x, y, z = getElementPosition ( player ) r = getPlayerRotation ( player ) interior = getElementInterior ( player ) dimension = getElementDimension ( player ) x = x - ( ( math.cos ( math.rad ( r + 90 ) ) ) * d ) y = y - ( ( math.sin ( math.rad ( r + 90 ) ) ) * d ) setTimer ( setElementInterior, 800, 1, sourcePlayer, interior ) setTimer ( setElementDimension, 900, 1, sourcePlayer, dimension ) setTimer ( setElementPosition, 1000, 1, sourcePlayer, x, y, z ) setTimer ( setPlayerRotation, 1000, 1, sourcePlayer, r ) fadeCamera ( sourcePlayer, false, 1, 0, 0, 0 ) setTimer ( fadeCamera, 1000, 1, sourcePlayer, true, 1 ) end If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Saml1er Posted May 3, 2014 Posted May 3, 2014 Change this at line 3: function ( playername) Change this at line 4: if not playername then return end Change this at line 26: local _, _, r = getElementRotation ( player ) And replace sourcePlayer with source(if you do other stuff for the player who triggered the event ) else replace it with player.
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