Jump to content

DLmass

Members
  • Posts

    74
  • Joined

  • Last visited

Details

  • Location
    Sweden

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

DLmass's Achievements

Transformer

Transformer (11/54)

0

Reputation

  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..
×
×
  • Create New...