-
Posts
244 -
Joined
-
Last visited
Everything posted by Alpha
-
Probably the calculations are wrong. Use this: function findRotation(startPosX, startPosY, endPosX, endPosY) return 360 - (math.deg(math.atan2(endPosX - startPosX, endPosY - startPosY)) % 360) end
-
No, because we're not going to test it for you, test it using /debugscript 3 and then come back with the errors.
-
marcador = createMarker ( 168.55726623535, -15.098962783813, 1.578125, "cylinder", 2, 0, 200, 0, 90 ) local teamtrucker = teamtrucker = createTeam ( "Camioneros", 0, 200, 0 ) function camionero ( hitPlayer ) setPlayerNametagColor ( hitPlayer, 0, 200, 0) setElementModel ( hitPlayer, 161 ) setPlayerTeam ( hitPlayer, teamtrucker ) local x, y, z = getElementPosition ( hitPlayer ) createVehicle ( 609, x, y, z) warpPedIntoVehicle ( hitPlayer , linerunner ) end addEventHandler ( "onMarkerHit", marcador, camionero )
-
Try: local curTarget local screenX , screenY = guiGetScreenSize ( ) addEvent('playCD', true) addEventHandler('playCD', root, function(cd) playSound(cd..'.mp3', false) end ) addEvent ( "client:setPlayerFollowPlayer" , true ) addEventHandler ( "client:setPlayerFollowPlayer" , root , function ( bool , target ) if bool == true then curTarget = target addEventHandler ( "onClientRender" , root , setPlayerFollowPlayer ) else showCursor(false) toggleAllControls(true) removeEventHandler ( "onClientRender" , root , setPlayerFollowPlayer ) end end ) function setPlayerFollowPlayer ( ) if isPedInVehicle ( curTarget ) then local vehicle = getPedOccupiedVehicle ( curTarget ) local seat = getPedOccupiedVehicleSeat ( curTarget ) if not warpPedIntoVehicle ( localPlayer , vehicle , seat + 1 ) then local posX , posY , posZ = getElementPosition ( vehicle ) setElementPosition ( localPlayer , posX , posY , posZ + 1 ) attachRotationAdjusted ( localPlayer , vehicle ) end else if isPedInVehicle ( localPlayer ) then removePedFromVehicle ( localPlayer ) end local posX , posY , posZ = getElementPosition ( localPlayer ) local posX2 , posY2 , posZ2 = getElementPosition ( curTarget ) local rotation = math.deg ( math.atan2 ( posX2 - posX , posY2 - posY ) ) % 360 setElementRotation ( localPlayer , 0 , 0 , 360 - rotation ) setCameraTarget ( localPlayer ) local distance = getDistanceBetweenPoints2D(posX2, posY2, posX, posY) if distance > 22 then setElementData(localPlayer, "Cuffed", false) setElementData(localPlayer, "Handcuffer", "") showCursor(false) toggleAllControls(true) removeEventHandler ( "onClientRender" , root , setPlayerFollowPlayer ) elseif distance > 12 then setControlState("sprint", true) setControlState("walk", false) setControlState("forwards", true) elseif distance > 6 then setControlState("sprint", false) setControlState("walk", false) setControlState("forwards", true) elseif distance > 1.5 then setControlState("sprint", false) setControlState("walk", true) setControlState("forwards", true) elseif distance < 1.5 then setControlState("sprint", false) setControlState("walk", false) setControlState("forwards", false) end end end function Follow(target, player) if not isPedInVehicle(player) then local px, py, pz = getElementPosition(player) local tx, ty, tz = getElementPosition(target) local angle = ( 360 - math.deg ( math.atan2 ( ( px - tx ), ( py - ty ) ) ) ) % 360 setPedRotation(target, angle) setCameraTarget(target) local distance = getDistanceBetweenPoints2D(px, py, tx, ty) if distance > 22 then stopFollow(target, player) setElementData(target, "Cuffed", false) setElementData(target, "Handcuffer", "") elseif distance > 12 then setControlState(target, "sprint", true) setControlState(target, "walk", false) setControlState(target, "forwards", true) followTimer[target] = setTimer(Follow, 500, 1, target, player) elseif distance > 6 then setControlState(target, "sprint", false) setControlState(target, "walk", false) setControlState(target, "forwards", true) followTimer[target] = setTimer(Follow, 500, 1, target, player) elseif distance > 1.5 then setControlState(target, "sprint", false) setControlState(target, "walk", true) setControlState(target, "forwards", true) followTimer[target] = setTimer(Follow, 500, 1, target, player) elseif distance < 1.5 then setControlState(target, "sprint", false) setControlState(target, "walk", false) setControlState(target, "forwards", false) followTimer[target] = setTimer(Follow, 500, 1, target, player) end end end function attachRotationAdjusted ( from, to ) local frPosX, frPosY, frPosZ = getElementPosition( from ) local frRotX, frRotY, frRotZ = getElementRotation( from ) local toPosX, toPosY, toPosZ = getElementPosition( to ) local toRotX, toRotY, toRotZ = getElementRotation( to ) local offsetPosX = frPosX - toPosX local offsetPosY = frPosY - toPosY local offsetPosZ = frPosZ - toPosZ local offsetRotX = frRotX - toRotX local offsetRotY = frRotY - toRotY local offsetRotZ = frRotZ - toRotZ offsetPosX, offsetPosY, offsetPosZ = applyInverseRotation ( offsetPosX, offsetPosY, offsetPosZ, toRotX, toRotY, toRotZ ) attachElements( from, to, offsetPosX, offsetPosY, offsetPosZ, offsetRotX, offsetRotY, offsetRotZ ) end function applyInverseRotation ( x,y,z, rx,ry,rz ) local DEG2RAD = (math.pi * 2) / 360 rx = rx * DEG2RAD ry = ry * DEG2RAD rz = rz * DEG2RAD local tempY = y y = math.cos ( rx ) * tempY + math.sin ( rx ) * z z = -math.sin ( rx ) * tempY + math.cos ( rx ) * z local tempX = x x = math.cos ( ry ) * tempX - math.sin ( ry ) * z z = math.sin ( ry ) * tempX + math.cos ( ry ) * z tempX = x x = math.cos ( rz ) * tempX + math.sin ( rz ) * y y = -math.sin ( rz ) * tempX + math.cos ( rz ) * y return x, y, z end addEventHandler ( "onClientRender" , root , function ( ) for index , player in ipairs ( getElementsByType ( "player" ) ) do if not getElementData ( player , "Arrested" ) then return end if getElementData(player, "Timeleft") < 1 then return end dxDrawFramedText ( "Time left: " .. getElementData ( player , "Timeleft" ) , ( screenX / 1440 ) * 720 , ( screenY / 900 ) * 200 , ( screenX / 1440 ) * 1440 , ( screenY / 900 ) * 200 , tocolor ( 255 , 255 , 255 , 255 ) , ( screenX / 1440 ) * 3 , "default-bold" , "center" , "center" , false , false , true ) if getElementData ( player , "Timeleft" ) < 6 then playSound ( getElementData ( player , "Timeleft" ) .. ".mp3" , false ) return end end end )
-
teamtrucker = createTeam ( "Camioneros", 0, 200, 0 ) marcador = createMarker ( 168.55726623535, -15.098962783813, 1.578125, "cylinder", 2, 155, 155, 105, 90 ) function camionero ( hitPlayer ) setPlayerNametagColor ( hitPlayer, 0, 200, 0) setElementModel ( hitPlayer, 161 ) setPlayerTeam ( hitPlayer, teamtrucker ) end addEventHandler ( "onMarkerHit", marcador, camionero ) function crearlinerunner (player) local x, y, z = getElementPosition (player) linerunner = createVehicle ( 609, x, y, z) setTimer ( warpPedIntoVehicle, 1000, 1, player, linerunner ) end addCommandHandler ( "Linerunner", crearlinerunner )
-
It's really messed up. Not sure this solves it, but it will remove the error: local guiElement = {} local animations = { { "RIOT", "RIOT_ANGRY" }, { "RIOT", "RIOT_ANGRY_B" }, { "RIOT", "RIOT_challenge" }, { "RIOT", "RIOT_CHANT" }, { "RIOT", "RIOT_FUKU" }, { "RIOT", "RIOT_PUNCHES" }, { "RIOT", "RIOT_shout" } } bindKey( "i", "down", function() if ( guiGetVisible( guiElement1 ) == false ) then guiSetVisible( guiElement1, true ) showCursor( true ) end end ) addEventHandler( "onClientResourceStart", resourceRoot, function() for i = 1, #animations do guiElement[i] = guiGridListAddRow( guiElement2 ) guiGridListSetItemText( guiElement2, guiElement5, guiElement..""..i, animations[i][1], false, false ) guiGridListSetItemText( guiElement2, guiElement6, guiElement..""..i, animations[i][2], false, false ) end end ) addEventHandler( "onClientGUIClick", elementGroup, function() if ( source == guiElement3 ) then if ( guiGridListGetSelectedItem) then ( guiElement2 )(guiElement[i]) (guiElemen) ( guiGridListGetSelectedItem)( guiElement2 ) if (guiElement[i]) and (guiElement6) then local block = guiGridListGetItemText( guiElement2, guiGridListGetSelectedItem( guiElement2 ), guiElement5 ) local animation = guiGridListGetItemText( guiElement2, guiGridListGetSelectedItem( guiElement2 ), guiElement6 ) if ( block ) and ( animation ) then triggerServerEvent( "onElementAnimation", elementPlayer, block, animation ) elseif ( source == guiElement4 ) then guiSetVisible( guiElement1, false ) showCursor( false ) end end end end end)
-
I tried to delete files when they're downloaded before, if you disconnect while downloading, the downloaded files so far is still there.
-
Also, I advise you to use callbacks, using dbPoll(queryHandle, -1) freezes the server.
-
Client: addEventHandler('onClientResourceStart', resourceRoot,function() --moved to client-side outputChatBox('Press F6 To Open Your Stats_Mangment !',255,255,0) centerWindow(GUIEditor_Window[1]) --forgot to call if gui is visible guiSetVisible(GUIEditor_Window[1],false) end) GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(420,259,582,358,"Stats_Manger By 'Dev-PoinT' v1.0",false) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_TabPanel[1] = guiCreateTabPanel(9,17,564,330,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Reset Mangement",GUIEditor_TabPanel[1]) GUIEditor_Image[1] = guiCreateStaticImage(11,1,174,107,"images/Controll.png",false,GUIEditor_Tab[1]) GUIEditor_Button[1] = guiCreateButton(82,133,124,32,"Dmg",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Button[2] = guiCreateButton(86,182,124,34,"Damage",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Button[3] = guiCreateButton(249,133,121,37,"Kills",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[3],"clear-normal") GUIEditor_Button[4] = guiCreateButton(395,136,133,32,"Deaths",false,GUIEditor_Tab[1]) guiSetFont(GUIEditor_Button[4],"clear-normal") GUIEditor_Button[5] = guiCreateButton(246,182,130,34,"Money",false,GUIEditor_Tab[1]) GUIEditor_Tab[2] = guiCreateTab("Help Mangement",GUIEditor_TabPanel[1]) GUIEditor_Memo[1] = guiCreateMemo(9,5,554,297,"\n#1 First tab use for resert your Dmg - Damage Kills- Deaths -Money To [ 0 ] |\n\n#2 Help Mangemnet You Can Put what you want By Make guiSetMemo read only (false) and type what you want then set it to (true).\n\n'Dev-PoinT Development.\n\nThank's",false,GUIEditor_Tab[2]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Tab[3] = guiCreateTab("V.I.P Mangment",GUIEditor_TabPanel[1]) GUIEditor_Button[6] = guiCreateButton(385,259,141,31,"give Money $ 1000",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[6],"clear-normal") GUIEditor_Image[2] = guiCreateStaticImage(358,183,180,54,"images/Dollars.png",false,GUIEditor_Tab[3]) GUIEditor_Button[7] = guiCreateButton(371,86,153,34,"M4 $ 500",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[7],"clear-normal") GUIEditor_Image[3] = guiCreateStaticImage(358,13,157,65,"images/7.png",false,GUIEditor_Tab[3]) GUIEditor_Button[8] = guiCreateButton(12,260,137,32,"Greande $ 2500",false,GUIEditor_Tab[3]) guiSetFont(GUIEditor_Button[8],"clear-normal") GUIEditor_Image[4] = guiCreateStaticImage(1,189,159,73,"images/1.png",false,GUIEditor_Tab[3]) GUIEditor_Label[1] = guiCreateLabel(187,17,137,15,"Buy Weapons ",false,GUIEditor_Tab[3]) guiLabelSetColor(GUIEditor_Label[1],0,255,255) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Image[5] = guiCreateStaticImage(10,15,146,127,"images/DecentGun.png",false,GUIEditor_Tab[3]) function open() --made the function shorter guiSetVisible(GUIEditor_Window[1],not guiGetVisible(GUIEditor_Window[1])) showCursor(guiGetVisible(GUIEditor_Window[1])) end bindKey("F6","down",open) function centerWindow(center_window) local screenW,screenH=guiGetScreenSize() local windowW,windowH=guiGetSize(center_window,false) local x,y = (screenW-windowW)/2,(screenH-windowH)/2 guiSetPosition(center_window,x,y,false) end addEventHandler('onClientGUIClick',guiRoot,function(button, state) --the absolute's are not needed as the buttons are on the gui if ( source == GUIEditor_Button[7] ) then triggerServerEvent('giveM',localPlayer) elseif ( source == GUIEditor_Button[8] ) then triggerServerEvent('giveG',localPlayer) elseif ( source == GUIEditor_Button[1] ) then setElementData(localPlayer, 'Dmg', 0 ) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[2] ) then setElementData( localPlayer, 'Damage', 0) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[3] ) then setElementData(localPlayer, 'Kills', 0 ) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[4] ) then setElementData(localPlayer,'Deaths', 0 ) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[5] ) then setPlayerMoney(localPlayer, 0 ) outputChatBox('successfully reset!',255 , 255, 0) elseif ( source == GUIEditor_Button[ 6] ) then givePlayerMoney( localPlayer , 100) outputChatBox('successfully Payed !',255 , 255, 0) end end,true)-- Forgot to add a boolean for the event (required)
-
It's better to use the new database functions: dbConnect dbQuery dbExec dbPoll dbFree
-
Try: addCommandHandler("godmode", function() if exports.global:isPlayerSuperAdmin() then if getElementData(localPlayer, "godmode") and getElementData(localPlayer, "godmode") == true then setElementData(localPlayer, "godmode", false) outputChatBox("God Mode is now disabled.", 0, 255, 0, false) else setElementData(localPlayer, "godmode", true) outputChatBox("God Mode is now enabled.", 0, 255, 0, false) end end end ) function togdamage(attacker, weapon, bodypart) if getElementData(source, "godmode") and getElementData(source, "godmode") == true then cancelEvent() end end addEventHandler("onClientPlayerDamage", localPlayer, togdamage)
-
Server: addEvent("submitLogin", true) addEvent("submitRegister", true) function loginHandler(username, password) local account = getAccount(username, password) if (account ~= false) then if (logIn(source, account, password) == true) then triggerClientEvent (source, "hideLoginWindow", source) end end end addEventHandler("submitLogin", root, loginHandler) function registerHandler(username, password) local account = getAccount(username, password) if (account ~= false) then outputChatBox( "", root, 255, 255, 255 ) else account = addAccount(username, password) if (logIn(source, account, password) == true) then triggerClientEvent(source, "hideRegisterWindow", getRootElement()) end end end addEventHandler("submitRegister", root, registerHandler)
-
SGC:RPG Live Support Script(Tell me what you think)
Alpha replied to Razerclaus's question in Client
Actually mine doesn't have live support, was planned, but delayed because of school. Now I'm too busy to complete it, but I will try to do it sometime. When you showcase something it has to be unique, neither the design nor the idea is unique. -
There is no getAccountData in the code you posted, post the code where the error occurs.
-
Why onPlayerDamage?
-
Morphine Item Does'nt Do else Code if health is not 100
Alpha replied to micheal1230's topic in Scripting
Try: elseif (itemID == 152) then -- Morphine if getElementHealth(source) < 100 then exports.global:sendLocalMeAction(source, "inject's some morphine into himself.") setElementHealth(source, 100) else setElementHealth(source, 50) exports.global:sendLocalMeAction(source, "inject's some morphine into himself and start's to feel dizzy.") end Probably because it returns float, which may cause problems when comparing. EDIT: You don't have to PM me. -
Morphine Item Does'nt Do else Code if health is not 100
Alpha replied to micheal1230's topic in Scripting
elseif (itemID == 152) then -- Morphine if getElementHealth(source) == 100 then setElementHealth(source, 50) exports.global:sendLocalMeAction(source, "inject's some morphine into himself and start's to feel dizzy.") else exports.global:sendLocalMeAction(source, "inject's some morphine into himself.") setElementHealth(source, 100) end getElementHealth will return the health, so you have to compare it (==) with 100. -
You have an error at line 7, and no need for account data, element data would be better. function saveSkin( player ) setElementData( player , "save-skin", getElementModel(player) ) end addEventHandler("onPlayerWasted", root, saveSkin ) function setSkin( player ) setElementModel( player, getElementData(player, "save-skin") ) end addEventHandler("onPlayerSpawn", root, setSkin )
-
There is nothing wrong with asking here, if you bring the code with you then it's totally fine.
-
SGC:RPG Live Support Script(Tell me what you think)
Alpha replied to Razerclaus's question in Client
Razerclaus, you're the one ruining the topic now. Anyway, I gotta agree with him, I don't see anything special in it. -
Great job, will test it soon.
-
I couldn't agree more, but unfortunately nothing says that compiled scripts can't be uploaded. A rule for that is needed.
-
It's not a violation to upload compiled resource, if it's stolen then okay, otherwise nope.
-
addEventHandler('guiSetVisible') What's that? GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|PlanetsTrip|=====\nWelcome to the\" Planets trip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Tickets|====\nMoon 50,000$\nMars 64,000$\nVenus 54,000$\nSaturn 75,000$\nMercury 35,000$=====|PlanetsTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false)
