Jump to content

Play3rPL

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by Play3rPL

  1. Hello KariiiM! Thanks for You help, I appreciate. Unfortunately, it gives still the same error, saved file, did refreshall, not working at all. Regards!
  2. Hello, I have to ask for Your help. This script [db.lua], that is supposed to make connection with the SQL Database doesn't work; server console gives exactly this error: [19:08:47] Starting pgs-vsystem [19:08:47] SCRIPT ERROR: [pgsgm]\pgs-vsystem\db.lua:8: '(' expected near 'connec tion' [19:08:47] ERROR: Loading script failed: [pgsgm]\pgs-vsystem\db.lua:8: '(' expec ted near 'connection' At this point, I don't have an idea, what can be wrong at line #8. Would You like to help me, please? Here's the code: --[[ Author: Play3rPL File: db.lua Purpose: Creating connection with SQL database. Shared?: No ]]-- function createDbCon connection = Connection "sqlite", SQLfilename ); if (connection) then outputServerLog ( "[iNFO] PGS-Pojazdy: Connected to database. [sql]" ); else outputServerLog ( "[WARNING] PGS-Pojazdy: Database connection couldn't be made. " ); end end addEventHandler ( "onResourceStart", resourceRoot, createDbCon); -- connection to database and creating tables if don't exist addEventHandler ( "onResourceStart", resourceRoot, function ( ) if sql.TableExists("pojazdy") then outputServerLog ( "[iNFO] PGS-Pojazdy: Database exists. Trying to load..." ); else outputServerLog ( "[WARNING] PGS-Pojazdy: Database doesn't exist. Trying to create..." ); if (!sql.TableExists("pojazdy")) then query = "CREATE TABLE IF NOT EXISTS `pojazdy` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `vehicle_model` INTEGER, `x` INTEGER, `y` INTEGER, `z` INTEGER, `rotX` INTEGER, `rotY` INTEGER, `rotZ` INTEGER, `color` VARCHAR, `upgrades` VARCHAR, `acc_name` VARCHAR, `plateText` VARCHAR )"; -- result = sql.Query(query) if (sql.TableExists("player_info")) then outputServerLog ( "[iNFO] PGS-Pojazdy: Empty database has been created. [sql]" ); else outputServerLog ( "[iNFO] PGS-Pojazdy: Database has not been created:" ); outputServerLog( sql.LastError( result ) .. "\n" ) outputServerLog ( "[DATABASE ERROR] PGS-Pojazdy: Script will not save any data." ); end else outputServerLog ( "[iNFO] PGS-Pojazdy: Empty database has been created. [sql]" ); end end ); Thank You everyone for Your help. Every help is highly appreciated! Good evening, ~ Play3rPL
  3. Notice, that console gives us error at line 117, because script that I mentioned above is only part of actual one. Cheers.
  4. Hello, I have a problem with two event handlers at the end of my code. One of these seems ignoring marker, that I created inside of my If statement declared in function. That variable is NOT declared as local, so I have completly no idea, why it is ignoring my marker. And I don't know, what is wrong with the second handler. Can anyone tell me, what is wrong with these both? pojazdlockmarker = null function unlock (player, key, state) local pojazd = getPedOccupiedVehicle(player) local islocked = isVehicleLocked(pojazd) local x, y, z = getElementPosition(pojazd) local lx = x+5 if (islocked == true ) then pojazdlockmarker = createMarker(lx, y, z, "cylinder", 1, 255, 0, 0, 0) end end function markerunlock() if getKeyState( "L" ) == true then setVehicleLocked(pojazd, false) outputChatBox ( "Otworzyłeś swój pojazd używając kluczyków!", player, 0, 255, 0 ) else outputChatBox ( "Ten pojazd nie należy do Ciebie!", player, 255, 0, 0 ) end end addEventHandler("onMarkerHit", pojazdlockmarker, markerunlock) addEventHandler("onVehicleStartExit", player, unlock) Thanks!
  5. Hi again, I have been thinking of using standard vehicle lights, that would be enabling and disabling continuouslyafter ppressing binded key. Any idea of making that?
  6. Ty for help! Oh, You are right! So, all that I have to do is a=0? Seems easy. Thank You! What about turn signals? Any help in this aspect? Cheerz
  7. Hello! Thanks for coming here. First at all, let me say that my English is not perfect, so it can be bad sometimes. Okay. I am asking You for help with two things: 1#: Unlocking locked vehicle outside it. Look: I made my own script for my RPG server; it allows You to enable lights using ; key, engine using K, enable Freeze-aka-handbrake using RCTRL, and lock vehicle using L key. Only driver can perform these things. So, there is my question: When car is locked, and You will exit that, You cannot unlock it anymore. I want to make script, that will allow You to unlock it, when ped is standing next to driver's doors using L key again. How can I script that? I have been thinking of making an INVISIBLE marker, next to driver's door. When ped will stay at it, he is able to unlock it using L key. Marker could be done by taking vehicle's x, y, z, and adding some numbers to x/y. But how can I do it invisible? VisibleTo function, or anything else? And how Can I cause unlock by using L? 2#: Turn signals. It's kinda important thing for RPG servers. Actually, I have no clue about making them. Using SetLightState probably, but I'm do not understand the use of them. -------------------------------- I am NOT asking for ready code; I'm asking for help and some clues about doing these things. Here's my actual code. I'm going to show it also to prove, that I actually did something: -------------------------------------- KONTROLKI - 8.0 local root = getRootElement () local thisResourceRoot = getResourceRootElement(getThisResource()) function thisResourceStart () local players = getElementsByType ( "player" ) for k,v in ipairs(players) do bindKey ( v, ";", "down", toggleVehicleLights, "Lights on/off" ) bindKey ( v, "k", "down", toggleVehicleEngine, "Engine on/off" ) bindKey ( v, "rctrl", "down", toggleVehicleHandbrake, "Handbrake on/off") bindKey ( v, "l", "down", toggleVehicleLock, "Doors locked/unlocked") end end function playerJoin () bindKey ( v, ";", "down", toggleVehicleLights, "Lights on/off" ) bindKey ( v, "k", "down", toggleVehicleEngine, "Engine on/off" ) bindKey ( v, "rctrl", "down", toggleVehicleHandbrake, "Handbrake on/off") bindKey ( v, "l", "down", toggleVehicleLock, "Doors locked/unlocked") end addEventHandler ( "onResourceStart", thisResourceRoot, thisResourceStart ) addEventHandler ( "onPlayerJoin", root, playerJoin ) -- Lampy function toggleVehicleLights ( player, key, state ) if ( getPedOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPedOccupiedVehicle ( player ) if ( getVehicleOverrideLights ( veh ) ~= 2 ) then setVehicleOverrideLights ( veh, 2 ) outputChatBox ( "Światła Włączone!", player, 0, 255, 0 ) else setVehicleOverrideLights ( veh, 1 ) outputChatBox ( "Światła Wyłączone!", player, 255, 0, 0 ) end end end -- Silnik function toggleVehicleEngine ( player, key, state ) if ( getPedOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPedOccupiedVehicle ( player ) if ( getVehicleEngineState ( veh ) == true ) then setVehicleEngineState ( veh, false ) outputChatBox ( "Silnik Wyłączony!", player, 255, 0, 0 ) else setVehicleEngineState ( veh, true ) outputChatBox ( "Silnik Włączony!", player, 0, 255, 0 ) end end end -- Ręczny function toggleVehicleHandbrake ( player, key, state ) if ( getPedOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPedOccupiedVehicle ( player ) local speed = getElementVelocity ( veh ) if ( speed == 0 ) then if ( isElementFrozen ( veh ) == false ) then setElementFrozen ( veh, true ) outputChatBox ( "Ręczny Zaciągnięty!", player, 255, 0, 0 ) else setElementFrozen ( veh, false ) outputChatBox ( "Ręczny Spuszczony!", player, 0, 255, 0 ) end else setControlState( player, handbrake, true) end end end -- Zamek function toggleVehicleLock ( player, key, state ) if ( getPedOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPedOccupiedVehicle ( player ) if ( isVehicleLocked( veh ) == false ) then setVehicleLocked ( veh, true ) outputChatBox ( "Pojazd Zamknięty!", player, 255, 0, 0 ) else setVehicleLocked ( veh, false ) outputChatBox ( "Pojazd Otwarty!", player, 0, 255, 0 ) end end end I'm sorry for Polish chat outputs and --s; script is done one hundred % by me. Thanks, again, for any help! Cheers, Play3rPL
  8. Hello! Thanks for coming here. First at all, let me say that my English is not perfect, so it can be bad sometimes. Okay. I am asking You for help with two things: 1#: Unlocking locked vehicle outside it. Look: I made my own script for my RPG server; it allows You to enable lights using ; key, engine using K, enable Freeze-aka-handbrake using RCTRL, and lock vehicle using L key. Only driver can perform these things. So, there is my question: When car is locked, and You will exit that, You cannot unlock it anymore. I want to make script, that will allow You to unlock it, when ped is standing next to driver's doors using L key again. How can I script that? I have been thinking of making an INVISIBLE marker, next to driver's door. When ped will stay at it, he is able to unlock it using L key. Marker could be done by taking vehicle's x, y, z, and adding some numbers to x/y. But how can I do it invisible? VisibleTo function, or anything else? And how Can I cause unlock by using L? 2#: Turn signals. It's kinda important thing for RPG servers. Actually, I have no clue about making them. Using SetLightState probably, but I'm do not understand the use of them. -------------------------------- I am NOT asking for ready code; I'm asking for help and some clues about doing these things. Here's my actual code. I'm going to show it also to prove, that I actually did something: -------------------------------------- KONTROLKI - 8.0 local root = getRootElement () local thisResourceRoot = getResourceRootElement(getThisResource()) function thisResourceStart () local players = getElementsByType ( "player" ) for k,v in ipairs(players) do bindKey ( v, ";", "down", toggleVehicleLights, "Lights on/off" ) bindKey ( v, "k", "down", toggleVehicleEngine, "Engine on/off" ) bindKey ( v, "rctrl", "down", toggleVehicleHandbrake, "Handbrake on/off") bindKey ( v, "l", "down", toggleVehicleLock, "Doors locked/unlocked") end end function playerJoin () bindKey ( v, ";", "down", toggleVehicleLights, "Lights on/off" ) bindKey ( v, "k", "down", toggleVehicleEngine, "Engine on/off" ) bindKey ( v, "rctrl", "down", toggleVehicleHandbrake, "Handbrake on/off") bindKey ( v, "l", "down", toggleVehicleLock, "Doors locked/unlocked") end addEventHandler ( "onResourceStart", thisResourceRoot, thisResourceStart ) addEventHandler ( "onPlayerJoin", root, playerJoin ) -- Lampy function toggleVehicleLights ( player, key, state ) if ( getPedOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPedOccupiedVehicle ( player ) if ( getVehicleOverrideLights ( veh ) ~= 2 ) then setVehicleOverrideLights ( veh, 2 ) outputChatBox ( "Światła Włączone!", player, 0, 255, 0 ) else setVehicleOverrideLights ( veh, 1 ) outputChatBox ( "Światła Wyłączone!", player, 255, 0, 0 ) end end end -- Silnik function toggleVehicleEngine ( player, key, state ) if ( getPedOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPedOccupiedVehicle ( player ) if ( getVehicleEngineState ( veh ) == true ) then setVehicleEngineState ( veh, false ) outputChatBox ( "Silnik Wyłączony!", player, 255, 0, 0 ) else setVehicleEngineState ( veh, true ) outputChatBox ( "Silnik Włączony!", player, 0, 255, 0 ) end end end -- Ręczny function toggleVehicleHandbrake ( player, key, state ) if ( getPedOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPedOccupiedVehicle ( player ) local speed = getElementVelocity ( veh ) if ( speed == 0 ) then if ( isElementFrozen ( veh ) == false ) then setElementFrozen ( veh, true ) outputChatBox ( "Ręczny Zaciągnięty!", player, 255, 0, 0 ) else setElementFrozen ( veh, false ) outputChatBox ( "Ręczny Spuszczony!", player, 0, 255, 0 ) end else setControlState( player, handbrake, true) end end end -- Zamek function toggleVehicleLock ( player, key, state ) if ( getPedOccupiedVehicleSeat ( player ) == 0 ) then local veh = getPedOccupiedVehicle ( player ) if ( isVehicleLocked( veh ) == false ) then setVehicleLocked ( veh, true ) outputChatBox ( "Pojazd Zamknięty!", player, 255, 0, 0 ) else setVehicleLocked ( veh, false ) outputChatBox ( "Pojazd Otwarty!", player, 0, 255, 0 ) end end end I'm sorry for Polish chat outputs and --s; script is done one hundred % by me. Thanks, again, for any help! Cheers, Play3rPL
×
×
  • Create New...