Jump to content

KariiiM

Members
  • Posts

    1,312
  • Joined

  • Last visited

Everything posted by KariiiM

  1. Try it, not tested but should works and tell me the result function outputChange(dataName,oldValue) if getElementType(source) == "player" and dataName == "blood" then local newValue = getElementData(source,dataName) if newValue-oldValue < 0 then local time = getRealTime() setElementData ( source, "attacked", time.timestamp ) local timers = getTimers ( 999 ) -- Loop through the timer list for timerKey, timerValue in ipairs(timers) do -- kill the timer killTimer ( timerValue ) end setTimer ( delay1, 50, 1, source) end end end addEventHandler("onElementDataChange",getRootElement(),outputChange) function antiQuitPlayer ( quitType ) if quitType == "Quit" or quitType == "Timed out" then local time = getRealTime() local leavedTime = getElementData ( source, "attacked" ) if leavedTime then if time.timestamp-leavedTime < 15 then --banPlayer ( source, false, false, true, nil, nil, 3600 ) local playerAccount = getPlayerAccount(source) if (playerAccount) then setAccountData(playerAccount,'blood',-55) end end end end end addEventHandler ( "onPlayerQuit", getRootElement(), antiQuitPlayer ) function delay1 ( source) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 15 seconds left",source,255,69,0) setTimer ( delay2, 1000, 1, source ) end function delay2 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 14 seconds left",source,255,69,0) setTimer ( delay3, 1000, 1, source ) end function delay3 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 13 seconds left",source,255,69,0) setTimer ( delay4, 1000, 1, source ) end function delay4 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 12 seconds left",source,255,69,0) setTimer ( delay5, 1000, 1, source ) end function delay5 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 11 seconds left",source,255,69,0) setTimer ( delay6, 1000, 1, source ) end function delay6 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 10 seconds left",source,255,69,0) setTimer ( delay7, 1000, 1, source ) end function delay7 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 9 seconds left",source,255,69,0) setTimer ( delay8, 1000, 1, source) end function delay8 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 8 seconds left",source,255,69,0) setTimer ( delay9, 1000, 1, source ) end function delay9 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 7 seconds left",source,255,69,0) setTimer ( delay10, 1000, 1, source ) end function delay10 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 6 seconds left",source,255,69,0) setTimer ( delay11, 1000, 1, source ) end function delay11 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 5 seconds left",source,255,69,0) setTimer ( delay12, 1000, 1, source ) end function delay12 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 4 seconds left",source,255,69,0) setTimer ( delay13, 1000, 1, source ) end function delay13 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 3 seconds left",source,255,69,0) setTimer ( delay14, 1000, 1, source ) end function delay14 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 2 seconds left",source,255,69,0) setTimer ( delay15, 1000, 1, source ) end function delay15 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: 1 seconds left",source,255,69,0) setTimer ( delay16, 1000, 1, source ) end function delay16 ( source ) if ( not isElement ( source ) ) then return end outputChatBox ( "Antirelog: You can disconnect now.",source,255,69,0) end
  2. function outputChange(dataName,oldValue) if getElementType(source) == "player" and dataName == "blood" then local newValue = getElementData(source,dataName) if newValue-oldValue < 0 then local time = getRealTime() setElementData ( source, "attacked", time.timestamp ) local timers = getTimers ( 999 ) -- Loop through the timer list for timerKey, timerValue in ipairs(timers) do -- kill the timer killTimer ( timerValue ) end setTimer ( delay1, 50, 1, "" ) end end end addEventHandler("onElementDataChange",getRootElement(),outputChange) function antiQuitPlayer ( quitType ) if quitType == "Quit" or quitType == "Timed out" then local time = getRealTime() local leavedTime = getElementData ( source, "attacked" ) if leavedTime then if time.timestamp-leavedTime < 15 then --banPlayer ( source, false, false, true, nil, nil, 3600 ) local playerAccount = getPlayerAccount(source) if (playerAccount) then setAccountData(playerAccount,'blood',-55) end end end end end addEventHandler ( "onPlayerQuit", getRootElement(), antiQuitPlayer ) function delay1 ( ) outputChatBox ( "Antirelog: 15 seconds left",source,255,69,0) setTimer ( delay2, 1000, 1, "" ) end function delay2 ( ) outputChatBox ( "Antirelog: 14 seconds left",source,255,69,0) setTimer ( delay3, 1000, 1, "" ) end function delay3 ( ) outputChatBox ( "Antirelog: 13 seconds left",source,255,69,0) setTimer ( delay4, 1000, 1, "" ) end function delay4 ( ) outputChatBox ( "Antirelog: 12 seconds left",source,255,69,0) setTimer ( delay5, 1000, 1, "" ) end function delay5 ( ) outputChatBox ( "Antirelog: 11 seconds left",source,255,69,0) setTimer ( delay6, 1000, 1, "" ) end function delay6 ( ) outputChatBox ( "Antirelog: 10 seconds left",source,255,69,0) setTimer ( delay7, 1000, 1, "" ) end function delay7 ( ) outputChatBox ( "Antirelog: 9 seconds left",source,255,69,0) setTimer ( delay8, 1000, 1, "" ) end function delay8 ( ) outputChatBox ( "Antirelog: 8 seconds left",source,255,69,0) setTimer ( delay9, 1000, 1, "" ) end function delay9 ( ) outputChatBox ( "Antirelog: 7 seconds left",source,255,69,0) setTimer ( delay10, 1000, 1, "" ) end function delay10 ( ) outputChatBox ( "Antirelog: 6 seconds left",source,255,69,0) setTimer ( delay11, 1000, 1, "" ) end function delay11 ( ) outputChatBox ( "Antirelog: 5 seconds left",source,255,69,0) setTimer ( delay12, 1000, 1, "" ) end function delay12 ( ) outputChatBox ( "Antirelog: 4 seconds left",source,255,69,0) setTimer ( delay13, 1000, 1, "" ) end function delay13 ( ) outputChatBox ( "Antirelog: 3 seconds left",source,255,69,0) setTimer ( delay14, 1000, 1, "" ) end function delay14 ( ) outputChatBox ( "Antirelog: 2 seconds left",source,255,69,0) setTimer ( delay15, 1000, 1, "" ) end function delay15 ( ) outputChatBox ( "Antirelog: 1 seconds left",source,255,69,0) setTimer ( delay16, 1000, 1, "" ) end function delay16 ( ) outputChatBox ( "Antirelog: You can disconnect now.",source,255,69,0) end
  3. Hey,Is there's a different between dbQuery or dbExec in creating Table? --With dbQuery, dbQuery (connection, "CREATE TABLE IF NOT EXISTS `account` (`user TEXT`)") --With dbExec dbExec(connection, "CREATE TABLE IF NOT EXISTS `account` (`user TEXT`)")
  4. As i see you're asking for help about Teamspeak 3 and we're in MTA not teamspeak service, So, what's the kind of help you're asking for?
  5. The error is in client side, check if the SHOW trigger is exist in client or post the code of client
  6. Wrrite the error message of debug, my code look fine
  7. Try that function CHECK(thePlayer) local account = getPlayerAccount(thePlayer) local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Owner" ) )) then triggerClientEvent(thePlayer,"SHOW",thePlayer) else return outputChatBox("Access denied ! ",thePlayer,255,0,0) end end addCommandHandler("TIMES",CHECK)
  8. KariiiM

    .

    @BluntZ , it's a tool script to create gates automaticly, but he want to learn how to create it by scripting. Hello, to make a gate moving or openning, you need to use the main function is moveObject, click on the function to know more about it All the functions that you need to make a gate moving --Functions: createObject moveObject createMarker setTimer --or you can use it with colShape createColCircle --Events: onMarkerHit onMarkerLeave --copShape events: onColShapeHit onColShapeLeave Now you know which functions you need to do that, let's make a simple example to open a gate with marker local aGate = createObject( id, x, y, z ) -- creating the gate and defining it setElementRotation ( aGate , rx, ry, rz ) -- setting the rotation of the object that we created local theMarker = createMarker(x, y, z, "cylinder", 4,255,255,255,0) --we create our marker and set the alpha of it to 0 function openGate() moveObject ( aGate , speed, x, y, z ) end addEventHandler( "onMarkerHit", theMarker, openGate) function closeGate() moveObject (aGate , speed, x, y, z) end addEventHandler( "onMarkerLeave", theMarker, closeGate)
  9. You mean, each time you restart an different script this script of playtime show?
  10. Ah yes, thanks for your attention replace this line if ( exports.SAEGVIP:isPlayerVIP () ) then with this one if ( exports.SAEGVIP:isPlayerVIP (player) ) then
  11. So, there's something wrong in the vip resource
  12. Also no need for adding map settings into the meta ! "#maxplayers" value="[ 128 ]"> "#useLODs" value="[ false ]"> "#gamespeed" value="[ 1 ]"> "#minplayers" value="[ 0 ]"> "#gravity" value="[ 0.0080000003799796104 ]"> "#waveheight" value="[ 0 ]"> "#locked_time" value="[ false ]"> "#weather" value="[ 0 ]"> "#time" value="12:0">
  13. it's fixed now but all players can use jetpack + vip's players playing as cop can use jetpack too criminals can't use jetpack when have stars (only criminal problem fixed) So the exports of VIP doesn't works..
  14. You're welcome, are you using db functions for sqlite? because i see there are something not defined, i just saw it now i thought your problem was in the database connextion example; result = sql.Query(query) sql.Query ? -- is not defined same to query you tried to create a table and columns but this query is not defined in MTA at all, maybe you mean dbQuery there's no defirent between mysql and sqlite in scripting the different is sqlite create file and mysql connect your data to the web by phpMyAdmin
  15. Try that, it should work --[[ Author: Play3rPL File: db.lua Purpose: Creating connection with SQL database. Shared?: No ]]-- function createDbCon connection = dbConnect ("sqlite", "SQLfilename.db"); 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 );
  16. Try it and tell me the result addEventHandler ( "onPlayerLogin", getRootElement (), function ( ) bindKey(source,"J","down",jetpack) end) function jetpack(player,key,state) if ( state == "down" ) then if ( exports.SAEGVIP:isPlayerVIP () ) then if getTeamName(getPlayerTeam(player)) == "Police" or getTeamName(getPlayerTeam(player)) == "SWAT" or getTeamName(getPlayerTeam(player)) == "Military" then return end if ( getPlayerWantedLevel ( player ) > 0 ) then return end if (doesPedHaveJetPack(player)) then removePedJetPack(player) outputChatBox("Jetpack Removed.",player,255,0,0) else if (not doesPedHaveJetPack(player)) then givePedJetPack(player) outputChatBox("Jetpack Actived.",player,0,255,0) end end end end end
  17. I already did that, im sure you didn't try this last code that i made , it's with all features that you need addEventHandler ( "onPlayerLogin", getRootElement (), function ( ) bindKey(source,"J","down",jetpack) end) function jetpack(player,key,state) if ( exports.SAEGVIP:isPlayerVIP () ) then if getTeamName(getPlayerTeam(player)) == "Police" or getTeamName(getPlayerTeam(player)) == "SWAT" or getTeamName(getPlayerTeam(player)) == "Military" then return end if ( getPlayerWantedLevel ( player ) > 0 ) then return end if (doesPedHaveJetPack(player)) then removePedJetPack(player) outputChatBox("Jetpack Removed.",player,255,0,0) else if (not doesPedHaveJetPack(player)) then givePedJetPack(player) outputChatBox("Jetpack Actived.",player,0,255,0) end end end end
  18. Here you go,all what you need addEventHandler ( "onPlayerLogin", getRootElement (), function ( ) bindKey(source,"J","down",jetpack) end) function jetpack(player,key,state) if ( exports.SAEGVIP:isPlayerVIP () ) then if getTeamName(getPlayerTeam(player)) == "Police" or getTeamName(getPlayerTeam(player)) == "SWAT" or getTeamName(getPlayerTeam(player)) == "Military" then return end if ( getPlayerWantedLevel ( player ) > 0 ) then return end if (doesPedHaveJetPack(player)) then removePedJetPack(player) outputChatBox("Jetpack Removed.",player,255,0,0) else if (not doesPedHaveJetPack(player)) then givePedJetPack(player) outputChatBox("Jetpack Actived.",player,0,255,0) end end end end
  19. You mean all LAW team SWAT/Military and Police?
  20. --Should works, after starting the resource , disconnect and login again to get the bind addEventHandler ( "onPlayerLogin", getRootElement (), function ( ) bindKey(source,"J","down",jetpack) end) function jetpack(player,key,state) if ( exports.SAEGVIP:isPlayerVIP () ) then if (doesPedHaveJetPack(player)) then removePedJetPack(player) outputChatBox("Jetpack Removed.",player,255,0,0) else if (not doesPedHaveJetPack(player)) then givePedJetPack(player) outputChatBox("Jetpack Actived.",player,0,255,0) end end end end
  21. You're welcome, Use this function to do that setWeaponProperty
  22. Do it by yourself? and get your own Resolution, Here's full code i cleaned and added something local sx, sy = guiGetScreenSize() function createImage() dxDrawImage((sx - 68) / 2, (sy - 54) / 2, 68, 54, "yourcrosshair.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end addEventHandler("onClientVehicleEnter", getRootElement(), function (player, seat) local theVehicle = getPedOccupiedVehicle( player ) if ( player == getLocalPlayer() and getElementType ( theVehicle ) == 'vehicle' and isPedInVehicle ( player ) and getElementModel ( theVehicle ) == 432 ) then if (theVehicle) then addEventHandler ( "onClientRender", root, createImage ) end end end) function destroyImage(player, seat) if ( player == getLocalPlayer() and getElementType ( theVehicle ) == 'vehicle' and not isPedInVehicle ( player ) and getElementModel ( theVehicle ) == 432 ) then removeEventHandler ( "onClientRender", root, createImage ) end end addEventHandler("onClientVehicleExit", getRootElement(),destroyImage)
×
×
  • Create New...