'~DaLesTe^' Posted June 10, 2015 Share Posted June 10, 2015 How do I run this command as few teleports in size 0? Script: teleportes = { {"drift",-296.92343139648, 1539.3560791016, 75.5625,"Foi para a Pista de Drift"}, {"floresta",-1292.8233642578, -2159.5888671875, 22.212591171265,"Foi para a Floresta"}, {"bairro",770.75983886719, -673.3233032226, 366.39999389648,"Foi para o Bairro"}, {"mount",-2338.4633789063, -1623.2933349609, 483.70858764648,"Foi para o Mount Chilliad"}, {"praia",324, -1779, 5,"Foi para a Praia"}, {"pistals",1994, -2446, 14,"Foi para o Aeroporto de LS"}, {"pistalv",1498, 1528, 11,"Foi para o Aeroporto de LV"}, {"pistasf",-1339, 52, 15,"Foi para o Aeroporto de SF"}, {"favela",2249, -1047, 55,"Foi para a Favela"}, {"rampa1", -1594.1474609375, -254.13656616211, 476.79843139648,"Foi para a Rampa #1"}, {"paraquedas", 989.94641113281, -1621.0570068359, 2251.9091796875,"Foi saltar de Paraquedas"}, {"rampa2",1078.3706054688, 972.89129638672, 266.59530639648, "Foi para a Rampa #2"}, {"arena1",2026.0793457031, -1422.6387939453, 16.9921875,"Foi para a Arena #1"}, {"arena2",-2280.0202636719, 2308.8525390625, 4.9635863304138,"Foi para a Arena #2"}, {"x2",1330.7166748047, 2136.0305175781, 11.015625,"Foi para a Arena X2"}, {"x1", -5307.2294921875, -205.81309509277, 4956.482421875, "Foi para a Arena X1"}, {"arrancada",406.13702392578, 2537.8151855469, 16.546295166016,"Foi para a Arrancada"}, {"rampa3",1461.7163818359, 341.52435302734, 665.28228759766,"Foi para a Rampa #3"}, {"cj",2488, -1670, 14,"Foi para a Casa do CJ"}, {"hospital",1178.1077880859, -1323.4639892578, 14.103762626648,"Foi para o Hospital"}, {"mount",-2338.4633789063, -1623.2933349609, 483.70858764648,"Foi para o Mount Chilliad"}, {"topo",860.58880615234, -2287.9299316406, 892.32263183594,"Foi para o Topo"}, {"arena4", 2287.1967773438, 672.9337685547, 10.671875,"Foi para a Arena #4"}, {"ammu", 2119.7568359375, 957.57293701172, 10.81298828125,"Foi para a Ammu"}, {"avenida", 2058.6020507813, 837.92016601563, 6.8843750953674,"Foi para a Avenida"}, {"banco", 2156.4516601563 , 1991.3203125, 10.671875,"Foi para o Banco"}, {"arena", 580.9580078125, -3076.4384765625, 10.0703125,"Foi para a Arena"}, {"racha", 1006.9000244141, 2473.8000488281, 10.800000190735,"Foi para o Racha"}, } local commandSpam = {} function pCommandSpam(comando) for k,v in pairs(teleportes) do if getElementDimension(source, 0) then if comando == v[1] then if (not commandSpam[source]) then local veh = getPedOccupiedVehicle(source) setElementPosition ( source, v[2], v[3], v[4] ) if (veh) then setElementPosition ( veh, v[2], v[3], v[4] ) end if(v[5])then outputChatBox( "#fff000[ #ffffff/"..v[1].." #fff000] #ffffff".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ") "..v[5].." ", root, 0, 255, 0, true ) end commandSpam[source] = 1 elseif (commandSpam[source] == 1) then cancelEvent() outputChatBox ( "Por favor aguarde 20 segundos para se teleportar novamente!", source) else commandSpam[source] = commandSpam[source] + 1 end break end end end end addEventHandler("onPlayerCommand", root, pCommandSpam) setTimer(function() commandSpam = {} end, 20000, 0) function getPlayerFromID(id) return call(getResourceFromName("game_id"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end Link to comment
Castillo Posted June 10, 2015 Share Posted June 10, 2015 I don't quite understand what do you mean. Could you explain yourself better? Link to comment
'~DaLesTe^' Posted June 10, 2015 Author Share Posted June 10, 2015 I don't quite understand what do you mean.Could you explain yourself better? I want to make these teleports commands are possible only run them in dimension 0 in the game Link to comment
ALw7sH Posted June 10, 2015 Share Posted June 10, 2015 getElementDimension(source) == 0 instead of getElementDimension(source, 0) also you don't have to put this if inside the loop 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