Jump to content

proracer

Members
  • Posts

    499
  • Joined

  • Last visited

Everything posted by proracer

  1. I have already tried it but still return error just different.Still thanks tho.
  2. Where is the type of script ...? <meta> <info author="Jumper_Mych" name="Photo" version="0.1 /> <script src="Microsoft.lua" type="client" /> <file src="images/Photo.png"/> <file src="images/Photo2.png"/> </meta>
  3. 1.Make sure this is clientside. 2.You must have your pictures in the same dir as stated in your script. 3.Add your pictures to meta file. 4.Type "/debugscript 2" and tell your errors.
  4. Try this uhm: StaticImage = {} Buttons = {} function Photo1() StaticImage[1] = guiCreateStaticImage(247,182,509,406, "images/Photo.png", false) StaticImage[2] = guiCreateStaticImage(247,182,509,406,"images/Photo2.png", false) Buttons[1] = guiCreateButton(248,564,45,24,"Prev",false,StaticImage[1]) Buttons[2] = guiCreateButton(248,564,45,24,"Next",false,StaticImage[2]) end addCommandHandler("photo", Photo1)
  5. You have attached command handler to non-existing function. Try this: function Photo1() Photo = guiCreateStaticImage( 247, 182, 509, 406, "images/Photo.png", false) ButtonNext = {}Photo = guiCreateButton(248,564,45,24,"Next",false, Photo2) Photo2 = guiCreateStaticImage(247,182,509,406,"images/Photo2.png",false) ButtonPrev = {}Photo2 = guiCreateButton(248,564,45,24,"Prev",false, Photo) end addCommandHandler ( "photo", Photo1)
  6. Hello all.I have tried new code for points system.But problem is in retrieving rows from table. 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 Points = executeSQLSelect ( "DMPoints", "points","serial = '" .. serial .. "'") outputChatBox("Let's retrieve rows again. \"{SMILIES_PATH}/icon_smile.gif\" alt=\"\" title=\"Smile\" />") outputChatBox(getPlayerName(tplayer).. "has:" ..Points[1]['points'].. "points.", getRootElement(), 255,140,0) end addCommandHandler("stats",stats) addCommandHandler("st",stats) function addPoints1(thePlayer, mapInfo, mapOptions, gameOptions) info = mapInfo.modename if mapInfo.modename == "Destruction derby" then local playername = getPlayerName(thePlayer) local serial = getPlayerSerial(thePlayer) local Points = executeSQLSelect ( "DMPoints", "points","serial = '" .. serial .. "'") outputChatBox("*Wins: "..playername.." took 10 Points for winning the match!",getRootElement(),255,255,0) Points = tonumber(Points[1]["points"]) + 10 setElementData(thePlayer ,"points", Points) setElementData(thePlayer ,"data.playername",playername,true) executeSQLUpdate ( "DMPoints", "points = '"..Points.."'","serial = '" .. serial .. "'") outputChatBox("Let's update our database. \"{SMILIES_PATH}/icon_razz.gif\" alt=\"\" title=\"Razz\" />") 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) Error @ line 42: attempt to index global 'points' (a nil value)
  7. Try it. exports.scoreboard:addScoreboardColumn('Money') function setstats () local account = getPlayerAccount (source) local money = getPlayerMoney ( source ) setElementData ( source, "Money", "$" .. money ) end addEventHandler ( "onPlayerSpawn", getRootElement(), setstats ) addEventHandler ( "onPlayerLogin", getRootElement(), setstats )
  8. proracer

    Fast question

    If I understood correctly, yes it's correct.Every client/server functions and events are made by MTA:SA devs.
  9. Sry for opening old thread back alive.Didn't wanted to create new one. So I wanted to ask how can I create achievement that gets example how many times player joined the server, how much time player is in server ... etc?
  10. If I'm not wrong you already set position of marker with your co-ordinates so you don't need to do call 'setElementInterior'. Btw if I'm not wrong if you do 'setElementDimension' to value of 3, the player must be in that selected dimension.
  11. Why did you set the dimension?
  12. proracer

    PM system

    Learn from this script. https://community.multitheftauto.com/index.php?p=resources&s=details&id=1562
  13. I accidently forgot to add serial category to Money table.Now it returns no errors but it simply doesn't work. EDIT: Console said some functions were deprecated so I edit it.Now it shows the error still but I don't know how to fix it. I have looked over the script many times and I can't find the error.
  14. proracer

    next map

    In race gamemode Nextmap script is already integrated.
  15. Hello all.I have tried to make simple cash system but I got a weird error. addEvent("onMapStarting") function creatingTables() executeSQLCreateTable("Money", "Cash INT") executeSQLCreateTable("DDDM", "serial STRING,DDAttempts INT") outputChatBox("Cash System by Pr0RaC3R started.") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), creatingTables) function ClientReady(g_player) local serial = getPlayerSerial(g_player) local playername = getPlayerName(g_player) CheckPlayer = executeSQLSelect ( "Money", "serial", "serial = '" .. serial .. "'" ) CheckPlayer2= executeSQLSelect ( "DDDM", "serial", "serial = '" .. serial .. "'" ) if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then executeSQLInsert ( "Money", "'"..serial.."','0','0','0','0'" ) end if ( type( CheckPlayer2 ) == "table" and #CheckPlayer2 == 0 ) or not CheckPlayer2 then executeSQLInsert ( "DDDM", "'"..serial.."','0','0'" ) end end addEvent("onClientReady",true) addEventHandler("onClientReady",getRootElement(),ClientReady) 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 local serial = getPlayerSerial(v) local DDAttempts = executeSQLSelect ( "DDDM", "DDAttempts","serial = '" .. serial .. "'") DDAttempts = tonumber(DDAttempts[1]["DDAttempts"]) + 1 executeSQLUpdate ( "DDDM", "DDAttempts = '"..DDAttempts.."'","serial = '" .. serial .. "'") setElementData(v,"data.DDAttempts",DDAttempts,true) end end end function DestructionMoney2(thePlayer) local playername = getPlayerName(thePlayer) local serial = getPlayerSerial(thePlayer) local Cash = executeSQLSelect ( "Money", "Cash","serial = '" .. serial .. "'") outputChatBox("*Wins: "..playername.." took $"..get('MoneyForDD').." for winning the map!",getRootElement(),255,255,0) Cash = tonumber(Cash[1]["Cash"]) + get('MoneyForDD') setElementData(thePlayer ,"Cash", Cash) setElementData(thePlayer ,"data.money",Cash,true) setElementData(thePlayer ,"data.playername",playername,true) executeSQLUpdate ( "Money", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") end function hunterBonus(pickupID, pickupType, vehicleModel) if info == "Destruction derby" then if pickupType == "vehiclechange" then if vehicleModel == 425 then local serial = getPlayerSerial(source) local Cash = executeSQLSelect ( "Money", "Cash","serial = '" .. serial .. "'") Cash = tonumber(Cash[1]["Cash"]) + 1000 outputChatBox("*Hunter: "..getPlayerName(source).." gets a $1000 hunter bonus!",source,25,125,225) setElementData(source ,"Cash", Cash) setElementData(source ,"data.money",Cash,true) executeSQLUpdate ( "Money", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") end end end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),hunterBonus) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() exports.scoreboard:addScoreboardColumn("Cash") end) addEventHandler("onMapStarting", getRootElement() , DestructionMoney) Error: Line33 (attempt to index field '?' (a nil value) )
  16. Well again try this.It should return no error.But about script I don't know if it works. addEventHandler ("onPlayerChat",getRootElement()) function abc (message,type) message = split(message,32) if (message[1] == "!points") then local player = getPlayerFromName(message[2]) or source local playerPoints = loadPlayerData (player,"points") setTimer(outputChatBox,50,1,getPlayerName (player) .. " #FF0000has " .. tostring(playerPoints) .. " points!",getRootElement(),255,0,0,true) end end addCommandHandler ( "name", abc )
  17. You forgot bracket. addEventHandler ("onPlayerChat",getRootElement(), function abc (message,type) message = split(message,32) if (message[1] == "!points") then local player = getPlayerFromName(message[2]) or source local playerPoints = loadPlayerData (player,"points") setTimer(outputChatBox,50,1,getPlayerName (player) .. " #FF0000has " .. tostring(playerPoints) .. " points!",getRootElement(),255,0,0,true) ) addCommandHandler ( "name", abc ) Try that.
  18. Someone else helped me.Thanks guys anway.
  19. I wanted to this too but I don't know how can I do that it works. You can find at "race_client.lua".I think it's there.
  20. Yeah forgot the event handler lol. Now it shows but its in my top left corner and barelly see's.So something co-ords is wrong.I changed all positions of GUI elements to fit all monitor resolutions.(like you posted in my thread) But you see it doesn't work .
  21. I edited the script a little but now it doesn't show. function drawRulesGUI() --- Using GUI Script Editor GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Checkbox = {} GUIEditor_Label = {} local sWidth,sHeight = 1920, 1080 showCursor(true,true) GUIEditor_Window[1] = guiCreateWindow( (sWidth-493)/sWidth, (sHeight-126)/sHeight, (sWidth-850)/sWidth, (sHeight-620)/sHeight, "TripleX Clan Server Rules [MUST READ!]",false) guiWindowSetSizable(GUIEditor_Window[1],false) guiWindowSetMovable(GUIEditor_Window[1],false) GUIEditor_Memo[1] = guiCreateMemo( (sWidth-13)/sWidth, (sHeight-81)/sHeight, (sWidth-828)/sWidth, (sHeight-465)/sHeight, "1. Do not cheat or use any 3rd party mod.\n\n2. Do not swear and insult our players or admins.\n\n3. We do not allow spamming and flooding the chat.\n\n4. Please respect all players and admins.\n\n5. If you want to join our clan please post it on our site.\n\n6. If you have any suggestions about server/site or scripts\n\n post it on our site.\n\n\n [ Coming GUI based Suggestions tab.]\n\n\n Have fun!",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1], true) GUIEditor_Checkbox[1] = guiCreateCheckBox( (sWidth-224)/sWidth, (sHeight-548)/sHeight, (sWidth-17)/sWidth, (sHeight-17)/sHeight, "",false,false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel( (sWidth-23)/sWidth, (sHeight-551)/sHeight, (sWidth-361)/sWidth, (sHeight-26)/sHeight, "I have read and I accept the rules.",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Button[1] = guiCreateButton( (sWidth-14)/sWidth, (sHeight-576)/sHeight, (sWidth-231)/sWidth, (sHeight-35)/sHeight, "I accept the rules.",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-bold-small") addEventHandler ("onClientGUIClick", GUIEditor_Button[1], function (button, state) if button == "left" and state == "up" then if guiCheckBoxGetSelected(GUIEditor_Checkbox[1]) == false then --checkbox not selected return else -- checkbox selected guiSetVisible(GUIEditor_Window[1], false) showCursor(false, false) outputChatBox("Thank you for accepting our rules.") end end end,false) end GUI doesn't show... no errors.
  22. Yes thanks.Figured it out myself ^^
  23. It works thanks.Only you forgot 1 'end'.Btw because dx elements are not parent with gui window how can I remove the dx drawings when he presses accept rules?
  24. Hello, I was creating a code so when player ticks the checkbox and presses the button he will agree with rules and if he does not ticks checkbox and immediately presses button it won't close window. The problem is that when I press checkbox and press the button it won't close the window.Don't bother reading the start. You can easily start reading from 25 to 40. Code: function drawRulesGUI() --- Using GUI Script Editor GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Checkbox = {} GUIEditor_Label = {} showCursor(true,true) GUIEditor_Window[1] = guiCreateWindow(493,126,850,620,"TripleX Clan Server Rules [MUST READ!]",false) guiWindowSetSizable(GUIEditor_Window[1],false) guiWindowSetMovable(GUIEditor_Window[1],false) GUIEditor_Memo[1] = guiCreateMemo(13,81,828,465,"1. Do not cheat or use any 3rd party mod.\n\n2. Do not swear and insult our players or admins.\n\n3. We do not allow spamming and flooding the chat.\n\n4. Please respect all players and admins.\n\n5. If you want to join our clan please post it on our site.\n\n6. If you have any suggestions about server/site or scripts\n\n post it on our site.\n\n\n [ Coming GUI based Suggestions tab.]\n\n\n Have fun!",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1], true) GUIEditor_Checkbox[1] = guiCreateCheckBox(224,548,39,20,"",false,false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(23,551,361,26,"I have read and I accept the rules.",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Button[1] = guiCreateButton(14,576,231,35,"I accept the rules.",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-bold-small") addEventHandler ("onClientGUIClick", GUIEditor_Button[1], drawRulesGUI) -- This segment of code is if player does not select checkbox and presses the button function rulesCheckBoxAndButton(button, state) if guiCheckBoxGetSelected(GUIEditor_Checkbox[1]) == false and button == "left" and state == "up" then return end -- This segment of code is if playe selects checkbox and presses the button if guiCheckBoxGetSelected(GUIEditor_Checkbox[1]) == true and button == "left" and state == "up" then guiSetVisible(GUIEditor_Window[1], false) showCursor(false, false) outputChatBox("Thank you for accepting our rules.") end end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), drawRulesGUI) -- Direct X Drawing addEventHandler("onClientRender",root, function() dxDrawText("Player Rules",536.0,172.0,817.0,217.0,tocolor(255,0,0,255),0.8,"bankgothic","top","left",false,false,false) dxDrawLine(497.0,201.0,1341.0,201.0,tocolor(255,0,0,255),1.0,false) end )
×
×
  • Create New...