Jump to content

KariiiM

Members
  • Posts

    1,312
  • Joined

  • Last visited

Everything posted by KariiiM

  1. findPlayer is not defined. local findPlayer = exports.SAEGPlayerFunctions:getPlayerFromNamePart(who) Post the exported function
  2. Bonus is totally right, but onPedDamage doesn't exist so, use onClientPedDamage atleast and logically we damage a ped not a player
  3. I cleared it abit,Full code: addEventHandler ("onPlayerLogin", root, function () bindKey ( source, "P", "down", toggleJetpack ) end) addEventHandler ("onResourceStart", resourceRoot, function () for index, player in ipairs (getElementsByType ("player")) do bindKey ( player, "J", "down", toggleJetpack ) end end) function toggleJetpack( thePlayer ) --give him one if he has access local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "V.İ.P" ) ) then -- Does he have access to Admin functions? if not doesPedHaveJetPack ( thePlayer ) then -- If the player doesn't have a jetpack give it. givePedJetPack ( thePlayer ) -- Give the jetpack else removePedJetPack ( thePlayer ) end end end
  4. Try that addEventHandler ("onResourceStart", resourceRoot, function () for index, player in ipairs (getElementsByType ("player")) do bindKey ( player, "J", "down", toggleJetpack ) end end) function toggleJetpack( thePlayer ) --give him one if he has access local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "V.İ.P" ) ) then -- Does he have access to Admin functions? if not doesPedHaveJetPack ( thePlayer ) then -- If the player doesn't have a jetpack give it. givePedJetPack ( thePlayer ) -- Give the jetpack else removePedJetPack ( thePlayer ) end end end
  5. I think the code is fine, you just have to add your law teams here PoliceTeam = {["Law Enforcement"] = true}
  6. Calm down, he just asked you to try something go to wiki read abit... and after all none here is your personal scripting assistant. so be nice
  7. Go to wiki and read directed Draw functions, do some efforts..
  8. From where you got this number?
  9. From the end, Do you want this code works only for A law team?
  10. If I am not wrong XAMPP doesn't works if skype is running, check XAMPP's logs to get where's the issue exists. Edit: next time try to post a screenshot
  11. function detachNeon( vehicle ) local attachedElements = getAttachedElements ( vehicle ) for i,v in ipairs ( attachedElements ) do detachElements ( v, vehicle ) destroyElement ( v ) end end addEvent( "detachNeon", true ) addEventHandler( "detachNeon", getRootElement(), detachNeon ) addEventHandler("onClientVehicleExplode", getRootElement(), function() -- the event perfect work setElementData( localPlayer, "neon", 0 ) -- Zerar triggerServerEvent ("detachNeon", getLocalPlayer(), vehicle) end) addEventHandler("onClientPlayerVehicleExit", getRootElement(),function(vehicle, seat) if vehicle then local driver = getVehicleController(vehicle) if (driver == localPlayer) then setElementData( driver, "neon", 0 ) -- Zerar triggerServerEvent ("detachNeon", getLocalPlayer(), vehicle) end end end)
  12. Is detachneon part worked? -- server side and tell me where's the problem now? which side client or server
  13. Yes it's possible, to host MySQL in local, use one of some programes which they supports PHP and MySQL so you can control your data. I suggest you to use XAMPP it contains about all these features. About how to open a connection to MySQL database, you've to use dbConnect function the usage of it should be like that, local connection = dbConnect("mysql", "dbname= myDbName; host= 127.0.0.1; port= 3306","root","","share=1")
  14. Should works, try it correctly and tell me the result addEventHandler("onClientPlayerVehicleExit", getRootElement(),function() if (isPedInVehicle(localPlayer)) then local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle then local driver = getVehicleController(vehicle) if (driver == localPlayer) then setElementData( localPlayer, "neon", 0 ) -- Zerar triggerServerEvent ("detachNeon", getLocalPlayer(), vehicle) end end end end)
  15. Glad to hear that, you're welcome dude
  16. I didn't understand what you want exactly, explain your problem clearly.
  17. You've to create a TABLE, like that dbExec(connection,"CREATE TABLE IF NOT EXISTS tableName(column1 TEXT,column2 INT) And ABOUT INSERT or UPDATE data into a table; like that --INSERT Data into a table a new table existing dbExec(connection,"INSERT INTO tableName(column1, column2) VALUS (?,?)", name, id) --UPDATE Data on a table already has datas and existing dbExec(connection,"UPDATE tableName SET column2=? WHERE column1='"..id.."'",name) Regards, -KariM
  18. Okay; First off, SQL is a programing language and 'MySQL' and 'SQLite' are a database systems,and what you need to know about the different between SQLite and MySQL is only in the system, the language is the same. So, I suggest you to start with SQLite system of it is storing all data in a file atleast of MySQL you must have to require a SQL server to connect your data AND as far as you're still begginer, SQLite should be easy for you to handle it for now. Anyway, So, to start scripting with SQL language in MTA you'll have to read more about these db functions i'll write the link in below: Note: those functions are SERVER Sided only and SQL language is made to be scripted in Server side dbFunctions After reading those functions, Let's learn how to create a database and how to to open a connection with the database. Our data base would be as a file because we're using SQLite system. In this case we should use this function to open the connection with the database. dbConnect dbConnect will connect to --Let's name our SQLite file (mydb.sql) now the function dbConnect will be able to open a connection to this file. local connection = dbConnect ( "sqlite" , "mydb.sql" ) --I did sqlite in the first argument because it's the type of database, second argument is for the database file. Now let's check if the connection is succesfully connected with our database. local connection = dbConnect ( "sqlite" , "mydb.sql" ) if (not connection) then --If not connected then return false outputDebugString("Failed to connect to SQLite file.") else outputDebugString("SQLite file has been connected succesfully.") --else return true. end
  19. --[[ ########################################################################## ## ## ## Project: 'Taser' - resource for MTA: San Andreas ## ## ## ########################################################################## [C] Copyright 2013-2014, Falke ]] local player = getElementsByType ( "player" ) local cFunc = {} local cSetting = {} cSetting["shots"] = {} cSetting["shot_calcs"] = {} local last_shot = 1 local a = cop -- FUNCTIONS -- cFunc["render_shots"] = function() for index, tbl in pairs(cSetting["shots"]) do HitCoord(tbl[1], tbl[2], tbl[3], tbl[4], tbl[5], tbl[6], tocolor(0, 255, 0)) end end cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2) table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2}) -- SHOT CALCULATING local lastx, lasty, lastz = x1, y1, z1 local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) cSetting["shot_calcs"][last_shot] = {} for i = 1, dis, 0.5 do -- cSetting["shot_calcs"][i] = nx, ny, nz -- cSetting["shot_calcs"][last_shot][i] = end last_shot = last_shot+1 end cFunc["shot_weapon"] = function(hitX, hitY, hitZ, x, y, z) local t = getPlayerTeam(getLocalPlayer()) if ( exports.SAEGPlayerFunctions:isTeamLaw (getTeamName (t))) then playSound3D("data/Fire.wav", x, y, z) local s = playSound3D("data/Fire.wav", hitX, hitY, hitZ) setSoundMaxDistance(s, 50) for i = 1, 5, 1 do fxAddPunchImpact(hitX, hitY, hitZ, 0, 0, 0) fxAddSparks(hitX, hitY, hitZ, 0, 0, 0, 8, 1, 0, 0, 0, true, 3, 1) end cFunc["draw_shot"](x, y, z, hitX, hitY, hitZ) fxAddPunchImpact(x, y, z, 0, 0, -3) end end cFunc["wait_shot"] = function() toggleControl("fire", false) setTimer(function() toggleControl("fire", true) end, 350, 1) end cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ) if(wp == 23) and ( exports.SAEGPlayerFunctions:isTeamLaw (getPlayerTeam(getLocalPlayer()))) then cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ) if(source == localPlayer) then cFunc["wait_shot"]() end end end HitCoord = function(x1, y1, z1, x2, y2, z2, color) local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) local lastx, lasty, lastz = x1, y1, z1 --for i = 1, dis, 3 do -- dxDrawLine3D(x1, y1, z1, x2, y2, z2) --end end cFunc["anim_check"] = function(_, wep, bodypart) local t = getPlayerTeam(getLocalPlayer()) if ( exports.SAEGPlayerFunctions:isTeamLaw (getTeamName (t))) then if(wep == 23) and (bodypart == 9) then setPedAnimation(source, "ped", "KO_shot_face", 10000, false, true, false) elseif(wep == 23) and (bodypart == 7) then setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) elseif(wep == 23) and (bodypart == 6) then setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) elseif(wep == 23) and (bodypart == 5) then setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) elseif(wep == 23) and (bodypart == 4) then setPedAnimation(source, "CRACK", "crckdeth3", 10000, false, true, false) elseif(wep == 23) and (bodypart == 3) then setPedAnimation(source, "ped", "KO_shot_stom", 10000, false, true, false) elseif(wep == 23) and (bodypart == 2) then setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) elseif(wep == 23) and (bodypart == 1) then setPedAnimation(source, "CRACK", "crckdeth2", 10000, false, true, false) end end end -- EVENT HANDLER -- addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"]) addEventHandler("onClientRender", getRootElement(), cFunc["render_shots"]) addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"]) addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"])
  20. Hello Razor, Is your problem how to make a SQL database ?
  21. Really? Do you think all these comments are useless, So that's mean you don't cares when most of them spend their time to write a paragraph to show you how to be a guy capable not a guy waiting for a done codes like what you guys do now. Personally, I agree with ViRuZGamiing's words.
  22. --client side addEventHandler("onClientVehicleExplode", getRootElement(), function() -- or root, or getLocalPlayer setElementData( localPlayer, "neon", 0 ) -- Zerar local theVehicle = getPedOccupiedVehicle ( localPlayer ) triggerServerEvent ("detachNeon", getLocalPlayer(), theVehicle) end) --server side local neons = {} function detachNeon( theVehicle ) for index, v in pairs(neons[theVehicle]) do if v and isElement(v) then destroyElement(v) end end end addEvent( "detachNeon", true ) addEventHandler( "detachNeon", getRootElement(), detachNeon ) addEventHandler( "onPlayerVehicleExit", getRootElement(), detachNeon ) function onPlayerQuit() local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local getNeonType = getElementData(source, "neon") if ( getNeonType ) then setAccountData ( playeraccount, "neon", getNeonType) local theVehicle = getPedOccupiedVehicle ( source ) if ( getNeonType ~= 0 ) and ( theVehicle ) then detachNeon( theVehicle ) end end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local getNeonTypeAccData = getAccountData ( playeraccount, "neon" ) if ( getNeonTypeAccData ~= 0 ) then setElementData(source, "neon", getNeonTypeAccData) end end end addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin )
  23. Yes I made it client sided but what do you want? do you want the player fly more than one meter?
  24. KariiiM

    Solved

    Nice to know that
×
×
  • Create New...