Jump to content

Bluebay

Members
  • Posts

    23
  • Joined

  • Last visited

Everything posted by Bluebay

  1. When i click (vehicle_fire), the car shoots a rocket, like here: https://www.youtube.com/watch?v=IReOzK7Y_Yo How can i do it?
  2. I need to config this resource?
  3. Hey, i wanted to ask, how to create a simple script, to a shooter server, to shoot from cars. Or can i find somewhere a script like this? So when i press vehicle_fire, a rocket appears.. I can shoot in every 3seconds. Thanks for the help, and sorry for the bad english.
  4. Okay, i'm done. but it's already bad. There is my connection.lua file: -- connection settings local hostname = get( "hostname" ) or "secret" local username = get( "username" ) or "secret" local password = get( "password" ) or "secret" local database = get( "database" ) or "secret" local port = tonumber(get( "port" )) or 3306 -- global things. local MySQLConnection = nil local resultPool = { } local sqllog = false local countqueries = 0 -- ToDatabase - Internal function, to spawn a DB connection function connectToDatabase(res) MySQLConnection = mysql_connect(hostname, username, password, database, port) if (not MySQLConnection) then if (res == getThisResource()) then cancelEvent(true, "Cannot connect to the database.") end return nil end return nil end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false) -- destroyDatabaseConnection - Internal function, kill the connection if theres one. function destroyDatabaseConnection() if (not MySQLConnection) then return nil end mysql_close(MySQLConnection) return nil end addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false) -- do something usefull here function logSQLError(str) local message = str or 'N/A' outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection)) exports['logs']:logMessage("MYSQL ERROR ! [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24) end function getFreeResultPoolID() local size = #resultPool if (size == 0) then return 1 end for index, query in ipairs(resultPool) do if (query == nil) then return index end end return (size + 1) end ------------ EXPORTED FUNCTIONS --------------- function ping() if (mysql_ping(MySQLConnection) == false) then -- FUU, NO MOAR CONNECTION destroyDatabaseConnection() connectToDatabase(nil) if (mysql_ping(MySQLConnection) == false) then logSQLError() return false end return true end return true end function escape_string(str) if (ping()) then return mysql_escape_string(MySQLConnection, str) end return false end function query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result return resultid end return false end function unbuffered_query(str) if sqllog then exports['logs']:logMessage(str, 24) end countqueries = countqueries + 1 if (ping()) then local result = mysql_unbuffered_query(MySQLConnection, str) if (not result) then logSQLError(str) return false end local resultid = getFreeResultPoolID() resultPool[resultid] = result return resultid end return false end function query_free(str) local queryresult = query(str) if not (queryresult == false) then free_result(queryresult) return true end return false end function rows_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_rows_assoc(resultPool[resultid]) end function fetch_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_fetch_assoc(resultPool[resultid]) end function free_result(resultid) if (not resultPool[resultid]) then return false end mysql_free_result(resultPool[resultid]) table.remove(resultPool, resultid) return nil end -- incase a nub wants to use it, FINE function result(resultid, row_offset, field_offset) if (not resultPool[resultid]) then return false end return mysql_result(resultPool[resultid], row_offset, field_offset) end function num_rows(resultid) if (not resultPool[resultid]) then return false end return mysql_num_rows(resultPool[resultid]) end function insert_id() return mysql_insert_id(MySQLConnection) or false end function query_fetch_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = fetch_assoc(queryresult) free_result(queryresult) return result end return false end function query_rows_assoc(str) local queryresult = query(str) if not (queryresult == false) then local result = rows_assoc(queryresult) free_result(queryresult) return result end return false end function query_insert_free(str) local queryresult = query(str) if not (queryresult == false) then local result = insert_id() free_result(queryresult) return result end return false end function escape_string(str) return mysql_escape_string(MySQLConnection, str) end function debugMode() if (sqllog) then sqllog = false else sqllog = true end return sqllog end function returnQueryStats() return countqueries -- maybe later more end
  5. But I have already installed it. It can be found at the 'modules' folder, and at the mtaserver.conf too. (But i still get this error.)
  6. So what i need to do? I need the modul, and i don't know what is the problem.
  7. When i have type "restart mysql" to the console, it says: [19:06:21] restart: Requested by Console [19:06:21] restart: Resource restarting... [19:06:21] Stopping mysql [19:06:21] Starting mysql [19:06:21] ERROR: mysql/connection.lua:16: attempt to call global 'mysql_connect ' (a nil value) [19:06:21] mysql restarted successfully Everybody says, that i need mta_mysql.so, but I HAVE IT! (Sorry for bad english)
  8. Now, that's what i need! Thank you! It's good, just the message is missing. Thank you for your lots of help too.
  9. But i need, to the command WORK in EVERY CAR, Except infernus. ("If it's an infernus, do not show the GUI?")
  10. Sry, now it works! But just in Banshee (line 55 cveh_c.lua) if ( vehicle ) and ( getElementModel( vehicle ) == 429 ) then I think because this. But i need, that this command work in every car, except Infernus. And i really need the message too, that: It's an infernus!
  11. Nothing happens, when i type /cveh. But i think, we can use getElementModel only in cveh_s.lua
  12. Okay so, now: ===cveh_c.lua=== ------------------------------------ -- QUANTUMZ - QUANTUMZ - QUANTUMZ -- ------------------------------------ -- 2011 - Romania -- ------------------------------------ -- You can modify this file but -- -- don't change the credits. -- ------------------------------------ ------------------------------------ -- VEHICLECONTROL v1.0 for MTA -- ------------------------------------ GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Scrollbar = {} GUIEditor_Window[1] = guiCreateWindow(709,236,272,288,"Jármû vezérlés",false) GUIEditor_Scrollbar[1] = guiCreateScrollBar(24,49,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(86,30,135,15,"Motorháztetõ",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(74,72,135,15,"Sofõr felöli ajtó",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Scrollbar[2] = guiCreateScrollBar(24,91,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(68,112,135,15,"Anyósülés felöli ajtó",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Scrollbar[3] = guiCreateScrollBar(24,130,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(71,151,135,15,"Sofõr mögötti hátsó ajtó",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Scrollbar[4] = guiCreateScrollBar(24,168,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(68,189,135,15,"Anyósülés mögötti hátsó ajtó",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Scrollbar[5] = guiCreateScrollBar(24,206,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[6] = guiCreateLabel(83,226,135,15,"Csomagtartó",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Scrollbar[6] = guiCreateScrollBar(24,243,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(23,265,230,14,"Ablak bezárása",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-small") guiWindowSetSizable ( GUIEditor_Window[1], false ) setElementData(GUIEditor_Scrollbar[1], "Type", 0) setElementData(GUIEditor_Scrollbar[2], "Type", 2) setElementData(GUIEditor_Scrollbar[3], "Type", 3) setElementData(GUIEditor_Scrollbar[4], "Type", 4) setElementData(GUIEditor_Scrollbar[5], "Type", 5) setElementData(GUIEditor_Scrollbar[6], "Type", 1) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) function enableVehicleControl() if isPedInVehicle( localPlayer ) then if guiGetVisible(GUIEditor_Window[1]) == false then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) else guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end end addCommandHandler("cveh", enableVehicleControl) function closeButton() guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], closeButton, false ) function updateRatio(Scrolled) local position = guiScrollBarGetScrollPosition(Scrolled) local door = getElementData(Scrolled, "Type") triggerServerEvent("moveThisShit", getLocalPlayer(), door, position) end addEventHandler("onClientGUIScroll", getRootElement(), updateRatio) ===cveh_s.lua=== -- Server function openDoor(door, position) local vehicle = getPedOccupiedVehicle(source) local Type = getElementModel( vehicle ) local ID = 411 if ( Type == ID ) then outputChatBox( "It's a BUS !", source, 255, 0, 0, true ) else if getPedOccupiedVehicleSeat(source) == 0 then if door == 0 then if position==0 then setVehicleDoorOpenRatio(vehicle, 0, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 0, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 0, position/100, 0.5) end end if door == 1 then if position==0 then setVehicleDoorOpenRatio(vehicle, 1, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 1, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 1, position/100, 0.5) end end end end end addEvent(":~", true) addEventHandler(":~", getRootElement(), openDoor) function enableVehicleControl() if isPedInVehicle( localPlayer ) then if guiGetVisible(GUIEditor_Window[1]) == false then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) else guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end end addCommandHandler("cveh", enableVehicleControl) function closeButton() guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], closeButton, false ) function updateRatio(Scrolled) local position = guiScrollBarGetScrollPosition(Scrolled) local door = getElementData(Scrolled, "Type") triggerServerEvent(":~", getLocalPlayer(), door, position) end addEventHandler("onClientGUIScroll", getRootElement(), updateRatio) When i type /cveh in the infernus, nothing happens, just a warning to the console: Warning: resource/cveh/cveh_s.lua:42: Bad argument @ 'isPedInVehicle'
  13. Yes, it is. And I need the cveh_s.lua, what will check that is this an infernus, or not?!
  14. My problem is, that i have a cveh_c.lua, and a cveh_s.lua file. But you included these to each other.
  15. Mr. ALM my problem is, that i have a cveh_c.lua, and a cveh_s.lua file. But you included these to each other.
  16. Hey guys! I have a command: /cveh, which is open the hood of a car. But i would like to do, if it's an infernus, they will can't, and they get a message: It's an INFERNUS! (Sorry for bad english) CLIENT side of the script: cveh_c.lua ------------------------------------ -- QUANTUMZ - QUANTUMZ - QUANTUMZ -- ------------------------------------ -- 2011 - Romania -- ------------------------------------ -- You can modify this file but -- -- don't change the credits. -- ------------------------------------ ------------------------------------ -- VEHICLECONTROL v1.0 for MTA -- ------------------------------------ GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Scrollbar = {} GUIEditor_Window[1] = guiCreateWindow(709,236,272,288,"Vehicle Control",false) GUIEditor_Scrollbar[1] = guiCreateScrollBar(24,49,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(86,30,135,15,"1",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(74,72,135,15,"2",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Scrollbar[2] = guiCreateScrollBar(24,91,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(68,112,135,15,"3",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Scrollbar[3] = guiCreateScrollBar(24,130,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(71,151,135,15,"4",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Scrollbar[4] = guiCreateScrollBar(24,168,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(68,189,135,15,"5",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Scrollbar[5] = guiCreateScrollBar(24,206,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[6] = guiCreateLabel(83,226,135,15,"6",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Scrollbar[6] = guiCreateScrollBar(24,243,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(23,265,230,14,"Close",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-small") guiWindowSetSizable ( GUIEditor_Window[1], false ) setElementData(GUIEditor_Scrollbar[1], "Type", 0) setElementData(GUIEditor_Scrollbar[2], "Type", 2) setElementData(GUIEditor_Scrollbar[3], "Type", 3) setElementData(GUIEditor_Scrollbar[4], "Type", 4) setElementData(GUIEditor_Scrollbar[5], "Type", 5) setElementData(GUIEditor_Scrollbar[6], "Type", 1) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) function enableVehicleControl() if isPedInVehicle( localPlayer ) then if guiGetVisible(GUIEditor_Window[1]) == false then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) else guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end end addCommandHandler("cveh", enableVehicleControl) function closeButton() guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], closeButton, false ) function updateRatio(Scrolled) local position = guiScrollBarGetScrollPosition(Scrolled) local door = getElementData(Scrolled, "Type") triggerServerEvent("moveThisShit", getLocalPlayer(), door, position) end addEventHandler("onClientGUIScroll", getRootElement(), updateRatio) SERVER side: cveh_s.lua function openDoor(door, position) local vehicle = getPedOccupiedVehicle(source) if getPedOccupiedVehicleSeat(source) == 0 then if door == 0 then if position==0 then setVehicleDoorOpenRatio(vehicle, 0, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 0, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 0, position/100, 0.5) end end if door == 1 then if position==0 then setVehicleDoorOpenRatio(vehicle, 1, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 1, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 1, position/100, 0.5) end end end end addEvent("moveThisShit", true) addEventHandler("moveThisShit", getRootElement(), openDoor) How can i do this? Thank you guys, for the help.
  17. Thanks, but i need the client file seperately. Or is it impossible?
  18. Hey guys! I have a command: /cveh, which is open the hood of a car. But i would like to do, if it's an infernus, they will can't, and they get a message: It's an INFERNUS! (Sorry for bad english) CLIENT side of the script: ------------------------------------ -- QUANTUMZ - QUANTUMZ - QUANTUMZ -- ------------------------------------ -- 2011 - Romania -- ------------------------------------ -- You can modify this file but -- -- don't change the credits. -- ------------------------------------ ------------------------------------ -- VEHICLECONTROL v1.0 for MTA -- ------------------------------------ GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Scrollbar = {} GUIEditor_Window[1] = guiCreateWindow(709,236,272,288,"Vehicle Control",false) GUIEditor_Scrollbar[1] = guiCreateScrollBar(24,49,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(86,30,135,15,"1",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(74,72,135,15,"2",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Scrollbar[2] = guiCreateScrollBar(24,91,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(68,112,135,15,"3",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Scrollbar[3] = guiCreateScrollBar(24,130,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(71,151,135,15,"4",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Scrollbar[4] = guiCreateScrollBar(24,168,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(68,189,135,15,"5",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Scrollbar[5] = guiCreateScrollBar(24,206,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[6] = guiCreateLabel(83,226,135,15,"6",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Scrollbar[6] = guiCreateScrollBar(24,243,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(23,265,230,14,"Close",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-small") guiWindowSetSizable ( GUIEditor_Window[1], false ) setElementData(GUIEditor_Scrollbar[1], "Type", 0) setElementData(GUIEditor_Scrollbar[2], "Type", 2) setElementData(GUIEditor_Scrollbar[3], "Type", 3) setElementData(GUIEditor_Scrollbar[4], "Type", 4) setElementData(GUIEditor_Scrollbar[5], "Type", 5) setElementData(GUIEditor_Scrollbar[6], "Type", 1) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) function enableVehicleControl() if isPedInVehicle( localPlayer ) then if guiGetVisible(GUIEditor_Window[1]) == false then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) else guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end end addCommandHandler("cveh", enableVehicleControl) function closeButton() guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], closeButton, false ) function updateRatio(Scrolled) local position = guiScrollBarGetScrollPosition(Scrolled) local door = getElementData(Scrolled, "Type") triggerServerEvent("moveThisShit", getLocalPlayer(), door, position) end addEventHandler("onClientGUIScroll", getRootElement(), updateRatio) SERVER side: function openDoor(door, position) local vehicle = getPedOccupiedVehicle(source) if getPedOccupiedVehicleSeat(source) == 0 then if door == 0 then if position==0 then setVehicleDoorOpenRatio(vehicle, 0, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 0, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 0, position/100, 0.5) end end if door == 1 then if position==0 then setVehicleDoorOpenRatio(vehicle, 1, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 1, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 1, position/100, 0.5) end end end end addEvent("moveThisShit", true) addEventHandler("moveThisShit", getRootElement(), openDoor) How can i do this? Thank you guys, for the help.
  19. Just look the video. (Not speedup) Sry for bad english https://www.youtube.com/watch?v=aIFcZjRBeT8
×
×
  • Create New...