Jump to content

DLmass

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by DLmass

  1. qaisjp explained to me on IRC what it does and does not. Thanks again mate! I've replaced onClientPlayerJoin with onClientResourceStart which made it work.
  2. I have some issues with this. No idea if it's a bug or not. Will someone let me know? function checkTransferBox() if not isTransferBoxActive() then outputDebugString("Not visible, proceed") else setTimer(checkTransferBox, 2000, 1) outputDebugString("Still visible, do not proceed") end end addEventHandler("onClientPlayerJoin", root, checkTransferBox)
  3. Got some help from Emile on #mta.scripting and he solved my issue. He is what he did and I am also posting this just incase others want to use it. Please lock this topic! addEvent( "onPlayerChangeTeam", true ) function onPlayerChangeTeam(newTeam, oldTeam) outputDebugString("Changed from "..getTeamName(oldTeam).." to "..getTeamName(newTeam).." successfully") if (countPlayersInTeam(oldTeam) == 0) then destroyElement(oldTeam) end end addEventHandler("onPlayerChangeTeam", root, onPlayerChangeTeam) _setPlayerTeam = setPlayerTeam function setPlayerTeam ( player, newTeam ) if not player or not newTeam then return false end local oldTeam = getPlayerTeam(player) _setPlayerTeam(player, newTeam) if (oldTeam) then triggerEvent("onPlayerChangeTeam", player, newTeam, oldTeam) end return true end
  4. Bad argument @ 'countPlayersInTeam' [Expected team at argument 1, got string 'TEST_TEAM']
  5. Sorry typo. It's already oldTeam
  6. Okay so basically I am using the built-in team functions for my gang-system. I've encountered some weird issues with it. The thing is that it works when I execute it with runcode but not at the actual script. I'm trying to check if there is players left in the team and if there is no one, it's supposed to get deleted. Well the script is self-explanatory. Help me please! I literally have no idea what I am suppose to add, maybe you can point my mistake out? Thanks in advance Runcode createTeam("MTA_TEST_TEAM", 255, 0, 0) if (countPlayersInTeam(getTeamFromName("MTA_TEST_TEAM")) == 0) then destroyElement(getTeamFromName("MTA_TEST_TEAM")) end Script addEvent( "onPlayerChangeTeam", true ) function onPlayerChangeTeam(newTeam, oldTeam) if (countPlayersInTeam(old) == 0) then destroyElement(old) end end addEventHandler("onPlayerChangeTeam", root, onPlayerChangeTeam) _setPlayerTeam = setPlayerTeam function setPlayerTeam ( player, newTeam ) if not player or not newTeam then return false end local oldTeam = getPlayerTeam(player) if (oldTeam) then triggerEvent("onPlayerChangeTeam", player, newTeam, oldTeam) end return _setPlayerTeam(player, newTeam) end
  7. Looks like I had to install libmysqlclient.so.16. I've decided that I will no longer convert the script to mta_mysql. Thanks for your help MrBrutus
  8. I did I just won't connect to my database!
  9. I can't use dbConnect. My server does not like it.. It always fails when I try to connect lol
  10. Well. I'm kinda trying to convert it over from built in mysql to mta_mysql. Everything else succeeds except this..
  11. hey MrBrutus, that does not work!
  12. No. I found this online actually
  13. I have no clue how to solve this. All help is much appreciated.. Thanks.. function sendVehicleInfo(player) local username = getElementData (player, "username") local veh = mysql_query(database, "SELECT * FROM vehicles WHERE username = '"..username.."'") if #veh > 0 then local ele = {} for i=1,#veh do if veh[i].spawned == 1 then ele[i] = spawnPlayerVehicle(player,vehicles[i],false) end veh[i].sellPrice = getVehicleSellPrice(veh[i].boughtprice,player) veh[i].boughtprice = false end triggerClientEvent(player,"receiveVehicles", player, veh, ele) end end Attempt to get lenght of local 'vehicles' (a userdata value) at line 4
  14. Hey and thanks for the nice reply. But yes that exstension is already added! It still does not remove.
  15. I still need help with this. Do anyone have a solution? I've tried everything..
  16. Hi I tried to remove this building http://i.imgur.com/7CYiyZC.png. But I get this result http://i.imgur.com/zaKEQbc.png I have no idea how to solve this.. "editor_main"> "removeWorldObject (skyscrapn203) (1)" radius="100" interior="0" model="4587" lodModel="4761" posX="1803.0859" posY="-1294.2031" posZ="71.53125" rotX="0" rotY="0" rotZ="0"> "removeWorldObject (skyscrapn203_gls) (1)" radius="100" interior="0" model="4605" lodModel="4762" posX="1823.6875" posY="-1291.25" posZ="7.3125" rotX="0" rotY="0" rotZ="0"> "removeWorldObject (Lan2officeflrs) (1)" radius="250" interior="0" model="3781" lodModel="120" posX="1809.09" posY="-1294.2" posZ="116.031" rotX="0" rotY="0" rotZ="0">
  17. I almost got what you mean. But still very confused lol EDIT: Still haven't solved it!
  18. Hi, I'd like to fix so I can delete markers with a command, I tried to do it but I cannot fix it. How can I solve this? local con = dbConnect("sqlite", "marker.db") dbExec(con, "CREATE TABLE IF NOT EXISTS marker ('x', 'y', 'z', 'dim', 'int')") function addMarker(player) local x,y,z = getElementPosition(player) local dim = getElementDimension(player) local int = getElementInterior(player) dbExec(con, "INSERT INTO marker VALUES (?, ?, ?, ?, ?)", x, y, z-1, dim, int) local marker = createMarker(x, y, z - 1, "cylinder", 1, 255, 0, 0, 150) setElementDimension(marker, dim) setElementInterior(marker, int) end addCommandHandler("am", addMarker) function deleteMarker(player) local x, y, z = getElementPosition(player) dbExec(con, "DELETE FROM marker WHERE x=? AND y=? and z=?", x, y, z) end addCommandHandler("dm", deleteMarker)
  19. I've noticed something. If I use under VALUES 10 it works but over VALUES 10 it fails This works dbExec( connection, "INSERT INTO accounts (username,password,health,armor,skin,money,posx,posy,posz,rot) VALUES (?,?,?,?,?,?,?,?,?,?)", username,sha256,health,armor,skin,money,posx,posy,posz,rot) This didn't work dbQuery( connection, "INSERT INTO accounts (username,password,money,skin,posx,posy,posz,rot,int,dim,health,armor) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)", username, sha256, 2000, math.random(7,288), 1653.67, -1657.99, 22.51, 178, 0, 0, 100, 100) This works dbQuery( connection, "INSERT INTO accounts (username,password) VALUES(?,?)", username, sha256)
  20. [17:07:36] WARNING: @[gamemode]/accounts/login_server.lua:96: dbExec failed; (10 64) You have an error in your SQL syntax; check the manual that corresponds to y our MySQL server version for the right syntax to use near 'int, dim, health, arm or) VALUES ('d', '3F39D5C348E5B79D06E842C114E6CC571583BBF44' at line 1 I got this error
  21. I have no rights to use that command!
  22. Those are set correctly and is working! ugh..
  23. it's connected to mysql. I don't use sql anymore..
  24. No error, theres nothing showing up. So yeah I'm confused.. btw, it's on linux debian! But if I use this it works like a charm! dbQuery( connection, "INSERT INTO accounts (username,password) VALUES(?,?)", username, sha256)
  25. Hi guys. I'm kinda stuck at this little thing underneath this line. It just won't insert into accounts table. dbQuery( connection, "INSERT INTO accounts (username,password,money,skin,posx,posy,posz,rot,int,dim,health,armor) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)", username, sha256, 2000, math.random(7,288), 1653.67, -1657.99, 22.51, 178, 0, 0, 100, 100) Please help me with this! kind regards, DLmass
×
×
  • Create New...