Jump to content

proracer

Members
  • Posts

    499
  • Joined

  • Last visited

Everything posted by proracer

  1. Hmm it still doesn't work... no errors.
  2. So have started making it.Only thing is it won't output the message in chatbox. ---- Clientsided function cgui() local sWidth, sHeight = guiGetScreenSize() local Width,Height = 629,451 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Grid = {} showCursor(true,true) PM_Main_Window = guiCreateWindow(X,Y,Width,Height,"PM System by Pr0RaC3R v0.1 Alpha",false) guiWindowSetSizable(PM_Main_Window,false) GUIEditor_Grid[1] = guiCreateGridList(9,20,611,206,false,PM_Main_Window) GUIEditor_Edit[1] = guiCreateEdit(9,226,611,141,"",false,PM_Main_Window) guiEditSetMaxLength(GUIEditor_Edit[1],100) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) GUIEditor_Button[1] = guiCreateButton(181,379,240,56,"Send message",false,PM_Main_Window) local column = guiGridListAddColumn(GUIEditor_Grid[1],"Player Name",0.2) if (column) then for id,player in ipairs (getElementsByType("player")) do local row = guiGridListAddRow(GUIEditor_Grid[1]) guiGridListSetItemText(GUIEditor_Grid[1],row,column,getPlayerName(player),false,false) end end end function playerPressButton (button,state,AbsoluteX,AbsoluteY) if (source == GUIEditor_Button[1]) then local text = guiGetText (GUIEditor_Edit[1]) outputChatBox(text) end end addCommandHandler("pm",cgui) I think the error should be between lines 27-33.
  3. Than probably you shouldn't use getRootElement for the servided script.Use your brain and think what argument you should use for the 2nd arg.
  4. Ok I have changed it but still nothing. local Points = executeSQLSelect("PointsSystem", "earnedpoints", "accountname = '"..getAccountName(getPlayerAccount(thePlayer)).."'") local DeathMatchesWon = executeSQLSelect("PointsSystem", "DMWins", "accountname = '"..getAccountName(getPlayerAccount(thePlayer)).."'") EDIT: New script: addEvent("onMapStarting") function createSQLTables() executeSQLCreateTable ("PointsSystem", "accountname TEXT, earnedpoints INT") executeSQLCreateTable ("PointsSystem2", "accountname TEXT, DMWins INT") executeSQLCreateTable ("PointsSystem3", "accountname TEXT, DMAttempted INT") outputChatBox("Points System by Pr0RaC3R, Pre-alpha v0.1 started!") outputChatBox("Points System is still in testing stage.Report any bugs on our site.") end addEventHandler ("onResourceStart", getRootElement(), createSQLTables) function login1(prev, account, autologin) local re = executeSQLSelect("PointsSystem", "earnedpoints", "accountname = '"..getAccountName(account).."'") local re2 = executeSQLSelect("PointsSystem", "DMWins", "accountname = '"..getAccountName(account).."'") local re3 = executeSQLSelect("PointsSystem", "DMAttempted", "accountname = '"..getAccountName(account).."'") if re and #re > 0 then setElementData(source, "earnedpoints2", tonumber(re[1]["earnedpoints"]) or 0) setElementData(source, "DMWins2", tonumber(re2[1]["DMWins"]) or 0) setElementData(source, "DMAttempted2", tonumber(re3[1]["DMAttempted"]) or 0) else executeSQLInsert("PointsSystem", "'0', '"..getAccountName(account).."'", "earnedpoints, accountname") executeSQLInsert("PointsSystem2", "'0', '"..getAccountName(account).."'", "DMWins, accountname") executeSQLInsert("PointsSystem3", "'0', '"..getAccountName(account).."'", "DMAttempted, accountname") end end addEventHandler("onPlayerLogin", getRootElement(), login1) function onPlayerQuit() local acc = getPlayerAccount(source) if not isGuestAccount(acc) then executeSQLUpdate("PointsSystem", "earnedpoints = '"..getElementData(source,"earnedpoints2").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate("PointsSystem2", "DMWins = '"..getElementData(source,"DMWins2").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate("PointsSystem3", "DMAttempted = '"..getElementData(source,"DMAttempted2").."'", "accountname = '"..getAccountName(acc).."'") end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) addEventHandler("onPlayerLogout", getRootElement(), onPlayerQuit) -- public stats command function publicstatsinfo( stats ) local askdname = getPlayerName ( source ) local DMWins = getElementData(source,"DMWins2") local DMAttempted = getElementData(source,"DMAttempted2") local points = getElementData(source,"earnedpoints2") local stats_int = tonumber( stats ) outputChatBox( "* ".. askdname .." Stats are:", 255, 12, 15 ) outputChatBox( "* Total Points gained: ".. points .."", 255, 12, 15 ) outputChatBox( "* Total Matches won: ".. DMWins .."", 255, 12, 15 ) outputChatBox( "* Total Matches played: ".. DMAttempted .."", 255, 12, 15 ) end addEvent("stats", true) addEventHandler( "stats",getRootElement(),publicstatsinfo ) function checkCommand ( message, messageType ) if ( messageType == 0 ) then if ( message == "!stats" ) then setTimer( triggerEvent, 100, 1, "stats", source ) end end end addEventHandler ( "onPlayerChat", getRootElement(), checkCommand ) --- function DestructionMoney(mapInfo,mapOptions,gameOptions) info = mapInfo.modename if mapInfo.modename == "Destruction derby" then local players = getElementsByType("player") for k,v in ipairs(players) do setElementData(v,"DMAttempted2",tonumber(getElementData(v,"DMAttempted2"))+1) executeSQLUpdate("PointsSystem3", "DMAttempted = '"..getElementData(v,"DMAttempted2").."'","accountname = '" .. getAccountName(getPlayerAccount(v)) .. "'") end end end function DestructionMoney2(thePlayer) local playername = getPlayerName(thePlayer) local Points = executeSQLSelect("PointsSystem", "earnedpoints", "accountname = '"..getAccountName(getPlayerAccount(thePlayer)).."'") local DeathMatchesWon = executeSQLSelect("PointsSystem", "DMWins", "accountname = '"..getAccountName(getPlayerAccount(thePlayer)).."'") outputChatBox("*Wins: "..playername.." took 10 points for surviving!",getRootElement(),255,255,0) setElementData(thePlayer ,"data.playername",playername,true) setElementData(thePlayer ,"earnedpoints2",tonumber(getElementData(thePlayer,"earnedpoints2"))+10) setElementData(thePlayer ,"DMWins2",tonumber(getElementData(thePlayer,"DMWins2"))+1) executeSQLUpdate("PointsSystem", "earnedpoints = '"..getElementData(thePlayer,"earnedpoints2").."'","accountname = '" .. getAccountName(getPlayerAccount(thePlayer)) .. "'") executeSQLUpdate("PointsSystem2", "DMWins = '"..getElementData(thePlayer,"DMWins2").."'","accountname = '" .. getAccountName(getPlayerAccount(thePlayer)) .. "'") end addEventHandler("onMapStarting", getRootElement() , DestructionMoney) Still doesn't add points and when I leave server it says: 'Database query failed: no such column name (accountname,DMWins and DMAttempted) - line 13,14,15,21
  5. https://wiki.multitheftauto.com/wiki/SetElementAlpha
  6. I have changed the arg to "thePlayer" but still nothing.
  7. Hello guys it's me again.I have been making some progress with simple stats system (yes it's very hard for me because I'm just learning LUA for 3 weeks). So my problem is script is adding new tables every map and it won't give points and add how much dm you won (race dm). Only part that is working is that it counts how much DM's you played. addEvent("onMapStarting") function createSQLTables() executeSQLCreateTable ("PointsSystem", "accountname TEXT, earnedpoints INT") executeSQLCreateTable ("PointsSystem2", "accountname TEXT, DMWins INT") executeSQLCreateTable ("PointsSystem3", "accountname TEXT, DMAttempted INT") outputChatBox("Points System by Pr0RaC3R, v0.1 started!") end addEventHandler ("onResourceStart", getRootElement(), createSQLTables) function login1(prev, account, autologin) local re = executeSQLSelect("PointsSystem", "earnedpoints", "accountname = '"..getAccountName(account).."'") local re2 = executeSQLSelect("PointsSystem", "DMWins", "accountname = '"..getAccountName(account).."'") local re3 = executeSQLSelect("PointsSystem", "DMAttempted", "accountname = '"..getAccountName(account).."'") if re and #re > 0 then setElementData(source, "earnedpoints2", tonumber(re[1]["earnedpoints"]) or 0) setElementData(source, "DMWins2", tonumber(re2[1]["DMWins"]) or 0) setElementData(source, "DMAttempted2", tonumber(re3[1]["DMAttempted"]) or 0) else executeSQLInsert("PointsSystem", "'0', '"..getAccountName(account).."'", "earnedpoints, accountname") executeSQLInsert("PointsSystem2", "'0', '"..getAccountName(account).."'", "DMWins, accountname") executeSQLInsert("PointsSystem3", "'0', '"..getAccountName(account).."'", "DMAttempted, accountname") end end addEventHandler("onPlayerLogin", getRootElement(), login1) function onPlayerQuit() local acc = getPlayerAccount(source) if not isGuestAccount(acc) then executeSQLUpdate("PointsSystem", "earnedpoints = '"..getElementData(source,"earnedpoints2").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate("PointsSystem2", "DMWins = '"..getElementData(source,"DMWins2").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate("PointsSystem3", "DMAttempted = '"..getElementData(source,"DMAttempted2").."'", "accountname = '"..getAccountName(acc).."'") end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) addEventHandler("onPlayerLogout", getRootElement(), onPlayerQuit) -- public stats command function publicstatsinfo( stats ) local askdname = getPlayerName ( source ) local DMWins = getElementData(source,"DMWins2") local DMAttempted = getElementData(source,"DMAttempted2") local points = getElementData(source,"earnedpoints2") local stats_int = tonumber( stats ) outputChatBox( "* ".. askdname .." Stats are:", 255, 12, 15 ) outputChatBox( "* Total Points gained: ".. points .."", 255, 12, 15 ) outputChatBox( "* Total Matches won: ".. DMWins .."", 255, 12, 15 ) outputChatBox( "* Total Matches played: ".. DMAttempted .."", 255, 12, 15 ) end addEvent("stats", true) addEventHandler( "stats",getRootElement(),publicstatsinfo ) function checkCommand ( message, messageType ) if ( messageType == 0 ) then if ( message == "!stats" ) then setTimer( triggerEvent, 100, 1, "stats", source ) end end end addEventHandler ( "onPlayerChat", getRootElement(), checkCommand ) --- function DestructionMoney(mapInfo,mapOptions,gameOptions) info = mapInfo.modename if mapInfo.modename == "Destruction derby" then local players = getElementsByType("player") for k,v in ipairs(players) do setElementData(v,"DMAttempted2",tonumber(getElementData(v,"DMAttempted2"))+1) end end end function DestructionMoney2(thePlayer) local playername = getPlayerName(thePlayer) local Points = executeSQLSelect("PointsSystem", "earnedpoints", "accountname = '"..getAccountName(account).."'") local DeathMatchesWon = executeSQLSelect("PointsSystem", "DMWins", "accountname = '"..getAccountName(account).."'") outputChatBox("*Wins: "..playername.." took 10 points for surviving!",getRootElement(),255,255,0) setElementData(thePlayer ,"data.playername",playername,true) setElementData(thePlayer ,"earnedpoints2",tonumber(getElementData(thePlayer,"earnedpoints2"))+10) setElementData(thePlayer ,"DMWins2",tonumber(getElementData(thePlayer,"DMWins2"))+1) end addEventHandler("onMapStarting", getRootElement() , DestructionMoney) NO ERRORS.But the problem is what I defined... it just won't give points and add how dm's you won.So probably there is some error between lines 75-84. Here I will copy a code from counting alive players.It's made by MAR (resource name - race_starter_pack) so thanks to him alot! AlivePlayers = {} function addStartingPlayers(newState,oldState) if newState == "GridCountdown" then if info == "Destruction derby" then cacheStartingPlayers() end end end addEventHandler("onRaceStateChanging",getRootElement(),addStartingPlayers) function cacheStartingPlayers() for k,thePlayer in ipairs(getElementsByType("player")) do if not isPlayerDead(thePlayer) and getPedOccupiedVehicle(thePlayer) then AlivePlayers[k] = thePlayer end end end function onPlayerQuit() if info == "Destruction derby" then for k,thePlayer in ipairs(getElementsByType("player")) do if thePlayer == source then table.remove(AlivePlayers,k) end end end end addEventHandler("onPlayerQuit",getRootElement(),onPlayerQuit) function removeAlivePlayers() if info == "Destruction derby" then for k,thePlayer in ipairs(getElementsByType("player")) do if thePlayer == source then table.remove(AlivePlayers,k) end end if #AlivePlayers == 1 then DestructionMoney2(AlivePlayers[1]) end end end addEventHandler("onPlayerWasted",getRootElement(),removeAlivePlayers) -- Nothing changed in his script.
  8. proracer

    Hydra Movie

    Actually, I think that is [sGA][email protected] should see him damnit.Nobody is better than him I'm sure.Great vid Xzibit!
  9. Use this: https://wiki.multitheftauto.com/wiki/GuiSetVisible https://wiki.multitheftauto.com/wiki/BindKey But I think you should create a window and all those elements should be parent with the window. Then using 'guiSetVisible' you will disable window with all child elements.
  10. Thx, so easy script but I was too sleepy to look after it inch by inch. Thanks alot!
  11. The new GUI design is pretty darn awesome.
  12. I have all car mods resources seperated eg., "customelegy", "customnrg".Because it's easier to use. -Yes I added files to meta.xml
  13. proracer

    [Help]BuyHay

    addEvent("buyHay", true) addEventHandler("buyHay", getRootElement(), function() if ( getPlayerMoney (source) >= 10000 ) then takePlayerMoney(source, 10000) x,y,z = getElementPosition( source ) createObject ( 3374, x, y, z, 120, 0, 0 ) outputChatBox("Hay Successfully droped", source, 255, 255, 0, true) else outputChatBox("Not enough money.", source, 255, 0, 0, true) end end ) ** All credits to the author! (Castillo)
  14. Hi all, I have been trying to replace NRG-500 and Elegy DFF and TXD files. Elegy: function ClientStarted() txd = engineLoadTXD ("elegy.txd") engineImportTXD (txd, 562) dff = engineLoadDFF ("elegy.dff") engineReplaceModel (dff, 562) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), ClientStarted ) function ClientStarted() txd = engineLoadTXD ("nrg500.txd") engineImportTXD (txd, 522) dff = engineLoadDFF ("nrg500.dff") engineReplaceModel (dff, 522) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), ClientStarted ) Always same error @ line 5,6: Bad 'string' pointer and bad 'dff' pointer. Is there something wrong with dff files or...?
  15. Try using this but I'm not really sure because I never used it. https://wiki.multitheftauto.com/wiki/GetVehicleSirensOn
  16. It should work.What errors it gives?
  17. No no... Put it here: server > mods > deathmatch > resources > (your resource name) - and in that folder is your script,meta file and dff and / or txd model
  18. Here is an example code: function ClientStarted() txd = engineLoadTXD ("infernus.txd") engineImportTXD (txd, 411) dff = engineLoadDFF ("infernus.dff") engineReplaceModel (dff, 411) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), ClientStarted ) Meta file for simplish: <meta> <script src="client.lua" type="client" /> <file src="infernus.txd" /> <file src="infernus.dff" /> </meta> Make sure you have script and the 1 (or 2 files if you include custom dff) in the resource folder.
  19. Custom handling will be integrated in new version of MTA; MTA 1.1
  20. Yes I know there is somewhere with retrieving the row but I don't know what is it. New code same error: @line 42 addEvent("onMapStarting") function recover(playerSource) if (isGuestAccount(getPlayerAccount(playerSource)) == false) then accountname = getAccountName (getPlayerAccount(playerSource)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then executeSQLDropTable("DMPoints") outputChatBox("Successfully Recovered. Please restart the resource. /restart points") end end end addCommandHandler("recover",recover) function createTables() executeSQLCreateTable("DMPoints","serial STRING,points INT") outputChatBox("Points System by -[xXx]-Pr0RaC3R version 0.1 started!", getRootElement(), 255,140,0) outputChatBox("Points database is successfully loaded.", getRootElement(), 255,140,0) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createTables) function ClientReady(g_player) local serial = getPlayerSerial(g_player) local playername = getPlayerName(g_player) CheckPlayer = executeSQLSelect ( "DMPoints", "serial", "serial = '" .. serial .. "'" ) outputChatBox("Now we have retrieved the rows from a table.") if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then executeSQLInsert ( "DMPoints","'"..serial.."','0'" ) outputChatBox("Rows are now really inserted.") end end addEvent("onClientReady",true) addEventHandler("onClientReady",getRootElement(),ClientReady) function stats(psource,cname,tplayer) if not getPlayerFromName(tplayer) then tplayer = psource else tplayer = getPlayerFromName(tplayer) end local serial = getPlayerSerial(tplayer) local addPts2 = executeSQLSelect ( "DMPoints", "points","serial = '" .. serial .. "'") outputChatBox("Let's retrieve rows again. \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" />") outputChatBox(getPlayerName(tplayer).. "has:"..addPts2[1]['points'].."points.", getRootElement(), 255,140,0) end addCommandHandler("stats",stats) addCommandHandler("st",stats) function addPoints1(mapInfo,mapOptions,gameOptions) info = mapInfo.modename if mapInfo.modename == "Destruction derby" then local players = getElementsByType("player") for k,v in ipairs(players) do local serial = getPlayerSerial(v) local addPts = executeSQLSelect ( "DMPoints", "points","serial = '" .. serial .. "'") addPts = tonumber(addPts[1]['points']) + 10 executeSQLUpdate ( "DMPoints", "points = '"..DDAttempts.."'","serial = '" .. serial .. "'") setElementData(v,"data.pts",addPts,true) end end end function hunterPointsBonus(pickupID, pickupType, vehicleModel) if info == "Destruction derby" then if pickupType == "vehiclechange" then if vehicleModel == 425 then local serial = getPlayerSerial(source) local Points = executeSQLSelect ( "DMPoints", "points","serial = '" .. serial .. "'") outputChatBox("Now we are retrieving the rows from database again.") Points = tonumber(Points[1]["points"]) + 5 outputChatBox("*Hunter: "..getPlayerName(source).." gets a 5 points hunter bonus!",source,25,125,225) setElementData(source ,"points", Points) executeSQLUpdate ( "DMPoints", "points = '"..Points.."'","serial = '" .. serial .. "'") outputChatBox("Again some updating. <33") end end end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),hunterPointsBonus) function RespawnTime(mapInfo,mapOptions) mapinfo = mapInfo.modename respawntime = mapOptions.respawntime end addEventHandler("onMapStarting",getRootElement(),RespawnTime) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() exports.scoreboard:addScoreboardColumn("Points") end) addEventHandler ( "onPlayerJoin", getRootElement(), function() local serial = getPlayerSerial(source) local Points = executeSQLSelect ( "DMPoints", "points","serial = '" .. serial .. "'") setElementData(source, "points", tonumber(Points[1]["points"])) end) addEventHandler("onMapStarting", getRootElement() , addPoints1)
  21. Don't use getRootElement because it's to trigger event for every player.Try this, not sure though. function death(thePlayer) killTimer( robbank ) end addEventHandler ( "onPlayerWasted", thePlayer, death )
  22. Here is all you need for start. http://lua-users.org/wiki/StringLibraryTutorial
  23. Try this. function robb (thePlayer) givePlayerMoney ( thePlayer, math.random(50000, 100000) ) setPlayerWantedLevel ( thePlayer, 6 ) end Because your function has "thePlayer" argument and you must use it.
  24. How we can send you file if we can't download too...?
×
×
  • Create New...