Jump to content

Wisam

Members
  • Posts

    168
  • Joined

  • Last visited

Everything posted by Wisam

  1. Hey.. so i got here a sqlite save system made by my friend that saves the player's basic stats such as money, weapon stas, skin, location...etc But my friend is too busy with the other scripts we are preparing and he said he can finish it later but i posted here because its an important script and i need it really soon before opening the server, also i don't want him to do all the work.. so ill post the script and i hope you can help me And here's what i did to test it: i started the script > joined the server > got my self weapons, money and weapon stats > i left the server and joined again > logged in , and i got nothing Here's what i got in the debug when Quiting the server: Sqlite_savesystem\server.lua:36: bad argument #1 to 'paris' (table expeced, got string) database = dbConnect( "sqlite", "datas.db" )-- connectDB skills = { [ 69 ] = 22, [ 70 ] = 23, [ 71 ] = 24, [ 72 ] = 25, [ 73 ] = 26, [ 74 ] = 27, [ 75 ] = 28, [ 76 ] = 29, [ 77 ] = 30, [ 78 ] = 31, [ 79 ] = 34, } if database then outputDebugString ('Connect') dbExec( database, "CREATE TABLE IF NOT EXISTS `accounts` ( `serial` text, `x` float, `y` float, `z` float, `intterior` int(5), `demension` int(5), `skin` int(3), `money` int(9), `health` float, `armor` float, `wanted` int(1), `guns` text)" ) else outputDebugString ("Trouble") end function getWeaponSlot( slot ) for i, v in pairs( skills ) do if v == slot then return v end end end function convertJSONToString( player ) local string = "" for i, v in pairs( player ) do if string == "" then string = string .. tostring( i ).. ":" .. tostring( v ).. "," end end end function convertStringToJson( player ) local json = { } local sp = split( player, "," ) for i, v in ipairs( sp ) do local sp2 = split( v, ":" ) json[ sp2[1] ] = sp2[2] end end function convertWeaponsToJSON(player) local weaponSlots = 12 local weaponsTable = {} for slot=1, weaponSlots do local weapon = getPedWeapon( source, slot ) local ammo = getPedTotalAmmo( source, slot ) if (weapon > 0 and ammo > 0) then weaponsTable[weapon] = ammo end end return toJSON(weaponsTable) end function giveWeaponsFromJSON(player, weapons) if (weapons and weapons ~= "") then for weapon, ammo in pairs(fromJSON(weapons)) do if (weapon and ammo) then giveWeapon(player, tonumber(weapon), tonumber(ammo)) end end end end function saveAccounts () -- Save in the database local serial = getPlayerSerial ( source ) local x,y,z = getElementPosition( source ) local i = getElementInterior( source ) local d = getElementDimension( source ) local skin = getElementModel ( source ) local money = getPlayerMoney ( source ) local health = getElementHealth ( source ) local armor = getPedArmor ( source ) local wanted = getPlayerWantedLevel ( source ) local weapons = convertJSONToString( convertWeaponsToJSON( source ) ) local q = dbQuery(database,"SELECT * FROM `accounts` WHERE `serial` = '".. serial .."'") local q = dbPoll( q, -1 ) if ( #q == 0 ) then dbExec( database, "INSERT INTO accounts ( `serial` , x, y, z, intterior, demension, skin, money, health, armor, wanted, guns ) VALUES ( '" .. serial .. "', " .. x .. ", " .. y .. ", " .. z .. "," .. i .. ", " .. d .. "," .. skin .. "," .. money .. ", ".. health ..", ".. armor ..", " .. wanted .. ", " .. weapons .. " )" ) else res = dbExec ( database, "UPDATE `accounts` SET x = ".. x ..", y = ".. y ..", z = ".. z ..", intterior = ".. i ..", demension = ".. d ..", skin = ".. skin ..", money = ".. money ..", health = ".. health ..", armor = ".. armor ..", wanted = ".. wanted ..", guns = " .. weapons .." WHERE `serial` = '"..serial.."'") end end function loadAccounts () -- Loading from the database local serial = getPlayerSerial ( source ) local result = dbPoll( dbQuery( database ,"SELECT * FROM `accounts` WHERE `serial` = '"..serial.."'" ), -1 ) if #result == 1 then while true do local row = result[ 1 ] outputChatBox ('Server has loaded your last location when you quit. @Build-By-Anubhav', source, 0, 255, 0, true) setElementPosition ( source, row.x, row.y, row.z) setElementInterior ( source, row.intterior ) setElementDimension ( source, row.demension ) setElementModel ( source, row.skin ) setPlayerMoney ( source, row.money ) setElementHealth ( source, row.health) row.guns = convertStringToJson( row.guns ) giveWeaponsFromJSON( source, row.guns ) setPedArmor ( source, row.armor ) setPlayerWantedLevel ( source, row.wanted ) break end end end addEventHandler ( "onPlayerSpawn", getRootElement(), loadAccounts ) addEventHandler ( "onPlayerQuit", getRootElement(), saveAccounts ) function onQuit ( ) local account = getPlayerAccount ( source ) if ( isGuestAccount ( account ) ) then return end setAccountData ( account, "stat22", tostring ( getPedStat ( source, 69 ) ) ) setAccountData ( account, "stat23", tostring ( getPedStat ( source, 70 ) ) ) setAccountData ( account, "stat24", tostring ( getPedStat ( source, 71 ) ) ) setAccountData ( account, "stat25", tostring ( getPedStat ( source, 72 ) ) ) setAccountData ( account, "stat26", tostring ( getPedStat ( source, 73 ) ) ) setAccountData ( account, "stat27", tostring ( getPedStat ( source, 74 ) ) ) setAccountData ( account, "stat28", tostring ( getPedStat ( source, 75 ) ) ) setAccountData ( account, "stat29", tostring ( getPedStat ( source, 76 ) ) ) setAccountData ( account, "stat30", tostring ( getPedStat ( source, 77 ) ) ) setAccountData ( account, "stat31", tostring ( getPedStat ( source, 78 ) ) ) setAccountData ( account, "stat32", tostring ( getPedStat ( source, 79 ) ) ) end addEventHandler ( "onPlayerQuit", getRootElement(), onQuit ) function playerLogin ( _, account ) local Pistolskill = getAccountData ( account, "stat22" ) if not Pistolskill then return end local SilencedPistolskill = getAccountData ( account, "stat23" ) local DesertEagleskill = getAccountData ( account, "stat24" ) local Shotgunskill = getAccountData ( account, "stat25" ) local SawnOffskill = getAccountData ( account, "stat26" ) local Spaz12skill = getAccountData ( account, "stat27" ) local Uziskill = getAccountData ( account, "stat28" ) local MP5skill = getAccountData ( account, "stat29" ) local AK47skill = getAccountData ( account, "stat30" ) local M4skill = getAccountData ( account, "stat31" ) local Sniperskill = getAccountData ( account, "stat32" ) setPedStat ( source, 69, Pistolskill ) setPedStat ( source, 70, SilencedPistolskill ) setPedStat ( source, 71, DesertEagleskill ) setPedStat ( source, 72, Shotgunskill ) setPedStat ( source, 73, SawnOffskill ) setPedStat ( source, 74, Spaz12skill ) setPedStat ( source, 75, Uziskill ) setPedStat ( source, 76, MP5skill ) setPedStat ( source, 77, AK47skill ) setPedStat ( source, 78, M4skill ) setPedStat ( source, 79, Sniperskill ) end addEventHandler ( "onPlayerLogin", getRootElement(), playerLogin )
  2. I made a file called skins and i put the skins there, included them in meta.xml: skins/survivor1.txd skins/survivor1.dff And in the server side script too i added: skins/survivor1.txd = 51, skins/survivor1.dff = 51, What could i have done wrong? myabe somthing must be added too in the client script? Nevermind, it worked perfectly with skins, weapons, wheels and vehicles Thanks alot brother
  3. I get no errors, only the download stops at 55%, the skin mods i added won't continue to load is it possible that the script don't support skin mods?!
  4. Nice one, first it worked for me but then i added 2 skin mods and then when i join the server the download freeze on 55% and still freezed, i added everything in meta.xml and codeMods.lua but it won't work.. please tell me what to do?
  5. Oh SQL, then where i have to put my SQL details in the script (hostname, username, password) ??
  6. I agree with you, Especially with these scripts. Im putting lots of mods in my server, So i have to put my ftp IP address in meta.xml and then the clients dont need to download the Huge files when joining for the first time?
  7. Thanks guys, i just changed the colShape height and it worked. I want a little help with another simple script similar to this, i want to make that when the player enter the zone he get a message above the radar " Safe Zone" and the message will stay till he leave the zone and if he leave the text will be gone: Here's the script and the dxDrawText: Server: addEventHandler ("onResourceStart",getResourceRootElement(getThisResource()), function() local allGreenzones = getElementsByType ("radararea") for i,v in ipairs (allGreenzones) do local r,g,b,a = getRadarAreaColor (v) if (r == 0) and (g == 255) and (b == 0) and (a == 127) then local x,y = getElementPosition (v) local sx,sy = getRadarAreaSize (v) local col = createColCuboid (x,y, -50, sx,sy, 7500) setElementID (col, "greenzoneColshape") end end end) addEventHandler ("onColShapeHit", getRootElement(), function(hitElement, matchingDimension) if (isElement(hitElement)) and (getElementType (hitElement) == "player") and (getElementID (source) == "greenzoneColshape") then toggleControl (hitElement, "fire", false) toggleControl (hitElement, "next_weapon", true) toggleControl (hitElement, "previous_weapon", true) toggleControl (hitElement, "aim_weapon", false) toggleControl (hitElement, "vehicle_fire", false) showPlayerHudComponent (hitElement, "ammo", true) showPlayerHudComponent (hitElement, "weapon", true) triggerClientEvent (hitElement, "enableGodMode", hitElement) end end) addEventHandler ("onColShapeLeave", getRootElement(), function(leaveElement, matchingDimension) if (getElementType (leaveElement) == "player") and (getElementID (source) == "greenzoneColshape") then toggleControl (leaveElement, "fire", true) toggleControl (leaveElement, "next_weapon", true) toggleControl (leaveElement, "previous_weapon", true) toggleControl (leaveElement, "aim_weapon", true) toggleControl (leaveElement, "vehicle_fire", true) showPlayerHudComponent (leaveElement, "ammo", true) showPlayerHudComponent (leaveElement, "weapon", true) triggerClientEvent (leaveElement, "disableGodMode", leaveElement) end end) Client: function godmodeHandler () cancelEvent () end addEvent ("enableGodMode",true) addEventHandler ("enableGodMode",getRootElement(), function() if (source == getLocalPlayer()) then addEventHandler ("onClientPlayerDamage",getRootElement(),godmodeHandler) end end) addEvent ("disableGodMode",true) addEventHandler ("disableGodMode",getRootElement(), function() if (source == getLocalPlayer()) then removeEventHandler ("onClientPlayerDamage",getRootElement(),godmodeHandler) end end) function zonetxt(source) dxDrawText("", 47, 770, 290, 770, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("Safe Zone", 88, 757, 202, 873, tocolor(0, 0, 0, 255), 1.20, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Safe Zone", 88, 755, 202, 871, tocolor(0, 0, 0, 255), 1.20, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Safe Zone", 86, 757, 200, 873, tocolor(0, 0, 0, 255), 1.20, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Safe Zone", 86, 755, 200, 871, tocolor(0, 0, 0, 255), 1.20, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Safe Zone", 87, 756, 201, 872, tocolor(42, 255, 0, 255), 1.20, "bankgothic", "left", "top", false, false, false, false, false) triggerServerEvent(hitElement,"onColShapeHit",hitElement) end addEventHandler ("onColShapeHit", getRootElement, zonetxt)
  8. if you mean MySQL then no i didn't Here's the debug: When i click deposit: http://i.imgur.com/ZYCm3v3.png When i click Withdraw: http://i.imgur.com/u39C78R.png And when i type /gc : http://i.imgur.com/uGXI27l.png Also, i thought smart added the log feature, why it says in chat that its not available yet?
  9. Greatest vehicle shop system i have ever seen! Fully working, 0 bugs and awesome features thank you again for sharing this bro. I got a suggestion that can be good and its to add a vehicle ownership limit and spawn limit, like only 5 vehicles can be spawned at once and only 10 vehicles can be owned per player
  10. Help!! i type /gc but the message don't output in the chatbox The group bank too, when i deposit money in the bank my money descrase but the money balance stays nil and i cant withdraw
  11. Hey guys im having a trouble with my paypal account and visa, here's what happend: 4 days ago I made a new visa for paypal and I deposited lots of money in it , when I login into my paypal account and try to add a new card it says that I can't add cards and to try again later, I tried alot but it says the same, but then I think it was added and I couldn't verfy it. Afterall I removed the card completly and tried to add it again but it didnt work and it said that this card is disabled from entering paypal system Please its very important, if you know anything about it and how to fix it please tell me
  12. So im building my rpg/zombie freeroam server and there is an important script that i changed somthing in it and it got bugged. So this script is supposto cancel the zombies to spawn in the area that is made and also kill any zombie enters the area. So i was adding more areas and suddenly it stopped working idk why, i mean zombies dont spawn in the area but they can enter it and never die.. oh and there was somthing wierd.. when they followed me inside the area they didnt die and then i jumped over a small obstacle and then when they tried to jump to follow me they died.. and also when i get to a tiny box or stair above the ground level they die too, so here's the script: [b]--This one prevents the zombies from spawning in the area[/b] -- Fort Carson Hospital safeColFCH = createColCuboid ( -348.83591, 1025.67822, 20.06553, 60, 60, 255 ) safeZoneRadarFCH = createRadarArea ( -348.83591, 1025.67822, 60, 60, 0, 94, 0, 80) setElementData (safeZoneRadarFCH, "zombieProof", true) --And this kill them when they enter the area above: function enterZone(hitPlayer,thePlayer) local skin = getElementModel (hitPlayer) if (skin == 13 or skin == 22 or skin == 56 or skin == 67 or skin == 68 or skin == 69 or skin == 75 or skin == 77 or skin == 84 or skin == 92 or skin == 95 or skin == 97 or skin == 105 or skin == 107 or skin == 108 or skin == 126 or skin == 127 or skin == 128 or skin == 152 or skin == 162 or skin == 167 or skin == 188 or skin == 195 or skin == 206 or skin == 209 or skin == 212 or skin == 213 or skin == 229 or skin == 230 or skin == 258 or skin == 264 or skin == 274 or skin == 277) then killPed (hitPlayer) else end end addEventHandler( "onColShapeHit", safeColFCH, enterZone )
  13. Hi there... So a while ago i decided to start learning to script and everything is going well i learned fast.. i can make server side scripts, i know almost all the functions and events, i made small, simple working scripts but im bored of doing little boring server side script and i wanted to learn to make client+server side scripts and gui stuff.. What i want to learn is How to connect server side functions to a gui so the buttons and other stuff in it will work, im good with building gui panels its really easy with "Gui Editor" , but what i don't know is how to connect the server side functions to the buttons, gridlists..etc as i said before. so if you know anything could help me like an example for a simple small script or a tutorial please post here. I wanna give you an example for what i mean so you understand me: I made a small gui panel with the buttons "Kill Me" , "Freeze Me and "Close" , so i want to connect the server side functions to the buttons like: killPlayer , setElementFrozen , guiSetVisible .
  14. Wisam

    [REL] IVSE 1.3

    ahh i guess nothing worked eventually, its been 2 weeks.. well thanks for all your help anyway
  15. So im posting this to tell you about my problem in the MTA forum and i tried to fix it but nothing worked and i thought someone here might help me.. so the problem is that a week ago i've been trying to login with my forum account using Google Chorme and suddenly it stopped working, i mean i type my username and password and click login and there is a message tells me i logged in successfully but i can't view my profile or post topics or replays. im posting this from firefox and i need to fix my google chrome thing cause firefox ads are really annoying and i dont use it anymore. So if you know anything about this please tell me how to fix it here. Thank you in advance
  16. Wisam

    [REL] IVSE 1.3

    Dude i really don't know what is the problem.. this is the first time somthing like that happens.. it appears like the database file is empty and it has no tables, if you're using it and works well upload your db file, it might work eventually
  17. Wisam

    [REL] IVSE 1.3

    This is the db file in your resource: https://mega.co.nz/#!3UpBzRST!bongLTru1 ... hOJqJdSrwM
  18. Man i don't have the words to describe this... you're a F*CKIN SAINT!!! if i saw you in real life i would kiss you really You saved me time, much of hard work and tons of money, you are the best human being in MTA community for posting this for free.. i've been searching and working on these kind of scripts for like 3 months and you posted it for FREE and DECOMPILED! OMG! am i dreaming? Thank you Thank You Thank You
  19. Wisam

    [REL] IVSE 1.3

    Lol idk what's wrong but i think you uploaded it with a bugged datebase cause when i tryed to open it in SQL editor it didnt open and it said wrong format.. could you just upload the database file? which contains the tabels and stuff this is the last thing i ask you to do
  20. Wisam

    [REL] IVSE 1.3

    I deleted version 1.3.0 and downloaded this 1.5.0 but still the same and i got few errors in the debug
  21. Wisam

    [REL] IVSE 1.3

    Dude i wish i could .. But team viewer dont work on my pc? Cant you just make a video?
  22. Wisam

    [REL] IVSE 1.3

    Man i've been 4 days struggling to get it to work.. i tryed EVERYTHING but it still dont work, i dont know much in SQLite so please fix it i really really need this script :c Thank You
  23. Hey I made a script for my server to change the weapon property damage and accuracy but then i wanted to make another script where i can change the weapon property of the chainsaw and katana but i noticed that the melee weapons are not listed in the menu, only fire arms and projectiles so if you could help me do this that would be great Also i tryed to do this but it didnt work: function damage() setWeaponProperty(9,"poor","damage", 1000) end addEventHandler ( "onResourceStart", getRootElement(), damage )
×
×
  • Create New...