SnoopCat Posted August 16, 2011 Posted August 16, 2011 i need to make a script for race that if you press a button it gives a hunter for 1 min and then u come back to the last car which function i have to use ??? can someone help me making this part for me ?? its not a script its just a part of script, but idk how to make this part help me to make it plz
Castillo Posted August 16, 2011 Posted August 16, 2011 Save the vehicle somewhere, could be element data, and then after 1 minute you give it getting the data from the player.
JR10 Posted August 16, 2011 Posted August 16, 2011 Lol, teach? Dude, if you are too lazy, then don't script at all. Learn: https://wiki.multitheftauto.com/wiki/Main_Page
Headshot4Fun Posted August 17, 2011 Posted August 17, 2011 Thats how i learn: I Read the wiki, everyday i read a new page and study the exemples. This makes you intelligent. Now, here goes the functions you will need to do this ( clientSide ) guiCreateButton() setTimer() getElementData() setElementData() setElementModel() guiGetScreenSize() And the Events: OnClientGUIClick() onClientResourceStart() And here is the page with all the vehicles ID ( https://wiki.multitheftauto.com/wiki/Vehicle_IDs ) Now. At least try, if you really can't do this by yourself i can try teach you.
SnoopCat Posted August 17, 2011 Author Posted August 17, 2011 this is the panel i have i really dont know how to finish the hunter part client: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(161,215,687,337,"Premium!",false) GUIEditor_Label[1] = guiCreateLabel(15,30,524,37,"Utiliza estas Funciones Gratuitamente",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],0,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[1],"center") guiSetFont(GUIEditor_Label[1],"sa-header") GUIEditor_Button[1] = guiCreateButton(21,95,155,26,"Hunter - 1 min",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(20,127,155,26,"Humo - Todo el map",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(20,158,155,26,"Reparar",false,GUIEditor_Window[1]) GUIEditor_Button[4] = guiCreateButton(20,193,155,26,"Nitro",false,GUIEditor_Window[1]) GUIEditor_Button[5] = guiCreateButton(99,126,5,5,"",false,GUIEditor_Button[4]) GUIEditor_Button[6] = guiCreateButton(19,228,155,26,"Invicible",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(214,93,155,26,"Indestructible",false,GUIEditor_Window[1]) GUIEditor_Button[8] = guiCreateButton(217,129,155,26,"rampa",false,GUIEditor_Window[1]) GUIEditor_Button[9] = guiCreateButton(398,280,275,46,"Cerrar [M]",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[9],"sa-header") GUIEditor_Button[10] = guiCreateButton(218,164,155,26,"Hay",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[9]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) elseif (source == GUIEditor_Button[3]) then triggerServerEvent ("premiumbuyfix", getLocalPlayer()) elseif (source == GUIEditor_Button[4]) then triggerServerEvent ("premiumbuynitro", getLocalPlayer()) elseif (source == GUIEditor_Button[2]) then triggerServerEvent ("premiumbuysmoke", getLocalPlayer()) elseif (source == GUIEditor_Button[8]) then triggerServerEvent ("premiumbuyrampa", getLocalPlayer()) elseif (source == GUIEditor_Button[6]) then triggerServerEvent ("premiumbuyinvisible", getLocalPlayer()) elseif (source == GUIEditor_Button[7]) then triggerServerEvent ("premiumbuyindestructible", getLocalPlayer()) elseif (source == GUIEditor_Button[10]) then triggerServerEvent ("premiumbuyhay", getLocalPlayer()) elseif (source == GUIEditor_Button[1]) then triggerServerEvent ("premiumbuyhunter", getLocalPlayer()) end end) addEvent("openPremiumPanel",true) addEventHandler("openPremiumPanel",getRootElement(), function () guiSetVisible (GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(not isCursorShowing()) end) Server side : function showPremiumPanel(thePlayer) local account = getPlayerAccount(thePlayer) if account then local accountname = getAccountName(account) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "premium" )) then triggerClientEvent (thePlayer, "openPremiumPanel", getRootElement()) else outputChatBox ("Premium: Accesso Denegado", thePlayer, 255, 0, 0) end end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "M", "down", showPremiumPanel ) end end) addEventHandler ( "onPlayerJoin", getRootElement(), function () bindKey ( source, "M", "down", showPremiumPanel ) end) addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource() ), function () for index, player in ipairs ( getElementsByType ( "player" ) ) do unbindKey ( player, "M", "down", showPremiumPanel ) end end) addEvent("premiumbuysmoke", true) addEventHandler("premiumbuysmoke", getRootElement(), function() if isPedInVehicle(source) then local x, y, z = getElementPosition( source ) local car = getPedOccupiedVehicle( source ) local ramp = createObject ( 2780, 0, 0, 0, 0, 0, 0 ) attachElements ( ramp, car, 0, -5.255, 0, 0, 45, 118 ) setElementAlpha ( ramp, 0 ) outputChatBox("*Premium: "..getPlayerName(source).." Se Puso Humo",getRootElement(),0,255,0) end end) addEvent("premiumbuyfix", true) addEventHandler("premiumbuyfix", getRootElement(), function() if isPedInVehicle(source) then fixVehicle( getPedOccupiedVehicle(source) ) outputChatBox("*Premium: "..getPlayerName(source).." Se ha Reparado",getRootElement(),0,255,0) end end ) addEvent("premiumbuynitro", true) addEventHandler("premiumbuynitro", getRootElement(), function() if isPedInVehicle(source) then addVehicleUpgrade(getPedOccupiedVehicle(source),1010) outputChatBox("*Premium: "..getPlayerName(source).." Se Puso Nitro",getRootElement(),0,255,0) end end ) addEvent("premiumbuyrampa", true) addEventHandler("premiumbuyrampa", getRootElement(), function() if isPedInVehicle(source) then targetPlayerName = getPlayerFromName ( source ) x, y, z = getElementPosition( source ) car = getPedOccupiedVehicle( source ) ramp = createObject(1634, x, y, z, 0, 0, 0) attachElements(ramp, car, 0, 2, 0, 0, 0, 180) outputChatBox("*premium: "..getPlayerName(source).." Se Puso una Rampa!",getRootElement(),0,255,0) end end ) addEvent("premiumbuyinvisible", true) addEventHandler("premiumbuyinvisible", getRootElement(), function() if isPedInVehicle(source) then setElementAlpha(getPedOccupiedVehicle(source),0) setElementAlpha(source,0) setPlayerNametagShowing(source, false) setTimer(function() setElementAlpha(source,255) setElementAlpha(getPedOccupiedVehicle(source),255) setPlayerNametagShowing ( source, true )end,120000,1) outputChatBox("*Premium: "..getPlayerName(source).." Se iso Invicible!",getRootElement(),0,255,0) end end ) addEvent("premiumbuyindestructible", true) addEventHandler("premiumbuyindestructible", getRootElement(), function() if isPedInVehicle(source) then setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) outputChatBox("*Premium: "..getPlayerName(source).." se iso Indestructible ",getRootElement(),0,255,0) end end ) addEvent("premiumbuyhay", true) addEventHandler("premiumbuyhay", getRootElement(), function() if isPedInVehicle(source) then x,y,z = getElementPosition( source ) setTimer(function()createObject ( 3374, x, y, z, 90, 0, 0 )end,3000,1) outputChatBox("*Botando Hay en 3 Segundos!",source,0,255,0) outputChatBox("*Premium: "..getPlayerName(source).." tiro un Hay!",getRootElement(),0,255,0) end end ) addEvent("premiumbuyhunter", true) addEventHandler("premiumbuyhunter", getRootElement(), function() if isPedInVehicle(source) then --there idk what to put to create the hunter by pressing the button "premiumbuyhunter" to create hunter by 1 min and then comimng back to old car-- attachElements ( smoke, car, 0, -5.255, 0, 0, 45, 118 )]
Castillo Posted August 17, 2011 Posted August 17, 2011 Maybe that's because you aren't TRYING at all? you are posting random codes to get someone else to make the real script.
SnoopCat Posted August 17, 2011 Author Posted August 17, 2011 sorry for double post but i have this for the server side for the hunter button addEvent("premiumbuyhunter", true) addEventHandler("premiumbuyhunter", getRootElement(), function() if isPedInVehicle(source) then theVehicle = getPedOccupiedVehicle ( thePlayer ) setElementModel ( theVehicle, 425 )
Castillo Posted August 17, 2011 Posted August 17, 2011 (edited) Try with this: addEvent("premiumbuyhunter", true) addEventHandler("premiumbuyhunter", getRootElement(), function() if isPedInVehicle(source) then local theVehicle = getPedOccupiedVehicle ( source ) setElementData(source,"tempVehicle",getElementModel(theVehicle)) setElementModel ( theVehicle, 425 ) setTimer(function (player) if player then local theVehicle = getPedOccupiedVehicle ( player ) setElementModel(theVehicle,tonumber(getElementData(player,"tempVehicle"))) end end, 60000, 1, source) end end) Edited August 17, 2011 by Guest
SnoopCat Posted August 17, 2011 Author Posted August 17, 2011 i have need to know 2 things more plz i need to know how to put a text to advertice the hunter time will finish and a thing that dont let u push the button 1 time each 2 minutes to prevent spam
Castillo Posted August 17, 2011 Posted August 17, 2011 I'd the "hard" part, now you should do the easy part .
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