proracer
Members-
Posts
499 -
Joined
-
Last visited
Everything posted by proracer
-
Thanks man it finally works.
-
I tested it but it doesn't work. I mean it doesn't show the picture...
-
No, I have already know how to set Relative Pos from Absolute... But I want that everyone can see the logo with every monitor resolution.So when I saw last example at site I posted in my previous post I created that.But it doesn't work. Btw I don't understand your post.It's all in my first post. LoL? I just did for example: sWidth - 0.3375 for turning the GUI to be set in same position as in all resolution monitors. Please check site on my previous post and look at last example. Btw, Code in my first post works and in second doesnt.
-
What is wrong?... Because I'm not really good with GUI's. I looked last example on this site: https://wiki.multitheftauto.com/wiki/GuiGetScreenSize
-
I have made this.But it isn't showing the image. function drawTripleXLogoImage() GUIEditor_Image = {} local sWidth, sHeight = guiGetScreenSize() GUIEditor_Image[1] = guiCreateStaticImage(sWidth-0.3375,sHeight-0.1898,sWidth-0.6661,sHeight-0.812,"triplexlogo.png",true) guiSetAlpha(GUIEditor_Image[1],1) end addEventHandler("onClientResourceStart",getRootElement(), drawTripleXLogoImage)
-
Why should I use relatives? Why I can't use the absolute Pos?
-
So I have created logo for our server.The code is this: function drawTripleXLogoImage() GUIEditor_Image = {} local sWidth, sHeight = guiGetScreenSize() GUIEditor_Image[1] = guiCreateStaticImage(sWidth-1334.976,sHeight-169.992,sWidth-1265.088,sHeight-910.008,"triplexlogo.png",false) guiSetAlpha(GUIEditor_Image[1],1) end addEventHandler("onClientResourceStart",getRootElement(), drawTripleXLogoImage) Some our players on server reported that they don't see the logo.I instantly thought I wrongly set up the script to work on all monitor resolutions but I don't understand... Where is the error? I see it normally because I use Res: 1920 * 1080 px.
-
Sorry for triple-post.I just wanted to notify if anyone can help because know it gets an error on first script @ line 38 : attempt to concatenate local 'ranks' a boolean value. Can someone help? Btw, I forgot to change type of this script to serversided lol.
-
It won't even create a table.I don't know why. (btw sorry for double-post) I edited the script a little and fixed some SQL errors but still nothing. Basic SQL functions in script. function createTables() executeSQLCreateTable("Points", "accountname TEXT, point INT") executeSQLCreateTable("Ranks", "accountname TEXT, rank INT") outputChatBox ("Points and Rank system by Pr0RaC3R has started.") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createTables) function login1(prev, account, autologin) local re = executeSQLSelect("Points", "point", "accountname = '"..getAccountName(account).."'") local re2 = executeSQLSelect("Ranks", "rank", "accountname = '"..getAccountName(account).."'") if re and #re > 0 then setElementData(source, "Ranks", tonumber(re2[1] ["rank"]) or 0) setElementData(source, "Points", tonumber(re[1]["point"]) or 0) else executeSQLInsert("Ranks", "'0', '"..getAccountName(account).."'", "rank, accountname") executeSQLInsert("Points", "'0', '"..getAccountName(account).."'", "point, accountname") end end addEventHandler("onPlayerLogin", getRootElement(), login1) function onPlayerQuit() local acc = getPlayerAccount(source) if not isGuestAccount(acc) then executeSQLUpdate("ranks", "rank = '"..getElementData(source,"Ranks").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate("points", "point = '"..getElementData(source,"Points").."'", "accountname = '"..getAccountName(acc).."'") end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) addEventHandler("onPlayerLogout", getRootElement(), onPlayerQuit) function publicstatsinfo( stats ) local askdname = getPlayerName ( source ) local ranks = getElementData(source,"Ranks") local points = getElementData(source,"Points") local stats_int = tonumber( stats ) outputChatBox( "* ".. askdname .." Stats are:", 255, 12, 15 ) outputChatBox( "* Rank: ".. ranks .."", 255, 12, 15 ) outputChatBox( "* Total Points gained: ".. points .."", 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 ) ------------------ Main points system: function DestructionMoney2(thePlayer) local playername = getPlayerName(thePlayer) local serial = getPlayerSerial(thePlayer) local Points = executeSQLSelect (Points, "point", "accountname = '"..getAccountName(account).."'") local Rank = executeSQLSelect(Ranks, "rank", "accountname = '"..getAccountName(account).."'") local getrank = exports.race:getPlayerRank(source) local placement = tostring(getrank) local addPoints = getPlayerCount()*1.5 local addPoints2 = tonumber(addPoints) outputChatBox(playername.." won "..addPoints2.."Congratulations!" ,getRootElement(),255,255,0) setElementData(thePlayer ,"PlayerPoints", Points) setElementData(thePlayer ,"data.playername",playername,true) setElementData(thePlayer ,"PlayerRanks",Ranks) executeSQLUpdate(ranks, "rank = '"..getElementData(source,"Ranks").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate(points, "point = '"..getElementData(source,"Points").."'", "accountname = '"..getAccountName(acc).."'") end
-
I don't really get that debugging.But I tried it and it looked like this. if getrank == 1 then outputDebugString("entered if") Its just the segment of the code. Other example: executeSQLUpdate(ranks, "rank = '"..getElementData(source,"Ranks").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate(points, "point = '"..getElementData(source,"Points").."'", "accountname = '"..getAccountName(acc).."'") outputDebugString("entered if") If that's it... it outputted no errors.
-
Yeah but I'm trying that the code works first.But of course it doesn't.Check it out... Points system: addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement()) function dmPoints(thePlayer) local playername = getPlayerName(thePlayer) local serial = getPlayerSerial(thePlayer) local Points = executeSQLSelect (Points, "point", "accountname = '"..getAccountName(account).."'") local Rank = executeSQLSelect(Ranks, "rank", "accountname = '"..getAccountName(account).."'") local getrank = exports.race:getPlayerRank(source) local addPoints = getPlayerCount()*1.5 local addPoints2 = tonumber(addPoints) if getrank == 1 then addPoints3 = tonumber(addPoints[1]["Points"]) + 10 outputChatBox(playername.." won "..addPoints2.."Congratulations!" ,getRootElement(),255,255,0) Rank = nil setElementData(thePlayer ,"PlayerPoints", addPoints3) setElementData(thePlayer ,"data.playername",playername,true) setElementData(thePlayer ,"PlayerRanks",Ranks) executeSQLUpdate(ranks, "rank = '"..getElementData(source,"Ranks").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate(points, "point = '"..getElementData(source,"Points").."'", "accountname = '"..getAccountName(acc).."'") end end Main points system: local root = getRootElement() function resourceStart() executeSQLCreateTable(Points, "accountname TEXT, point INT") executeSQLCreateTable(Ranks, "accountname TEXT, rank INT") outputChatBox ("Points and Rank system by Pr0RaC3R has started.") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resourceStart) function login1(prev, account, autologin) local re = executeSQLSelect(Points, "point", "accountname = '"..getAccountName(account).."'") local re2 = executeSQLSelect(Ranks, "rank", "accountname = '"..getAccountName(account).."'") if re and #re > 0 then setElementData(source, "Ranks", tonumber(re2[1] ["rank"] setElementData(source, "Points", tonumber(re3[1]["point"]) or 0) else executeSQLInsert(Ranks, "'0', '"..getAccountName(account).."'", "rank, accountname") executeSQLInsert(Points, "'0', '"..getAccountName(account).."'", "point, accountname") end end addEventHandler("onPlayerLogin", getRootElement(), login1) function onPlayerQuit() local acc = getPlayerAccount(source) if not isGuestAccount(acc) then executeSQLUpdate(ranks, "rank = '"..getElementData(source,"Ranks").."'", "accountname = '"..getAccountName(acc).."'") executeSQLUpdate(points, "point = '"..getElementData(source,"Points").."'", "accountname = '"..getAccountName(acc).."'") end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) addEventHandler("onPlayerLogout", getRootElement(), onPlayerQuit) function publicstatsinfo( stats ) local askdname = getPlayerName ( source ) local ranks = getElementData(source,"Ranks") local points = getElementData(source,"Points") local stats_int = tonumber( stats ) outputChatBox( "* ".. askdname .." Stats are:", 255, 12, 15 ) outputChatBox( "* Rank: ".. ranks .."", 255, 12, 15 ) outputChatBox( "* Total Points gained: ".. points .."", 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 ) ------------------
-
I have 1 more question.I'm struggling to create that if server have example 1 guy (only you) you will gain no points.And if player number increases by 1 it will increate points by 0.5.Do you have any idea how? EDIT: I have idea but it would take along time and I don't know if it would work. So for example like this: if (getPlayerCount() == 1) then addPoints = tonumber(addPoints[1]["Points"]) * 0 elseif (getPlayerCount() ==2) then addPoints = tonumber(addPoints[1]["Points"]) * 0.2 elseif (getPlayerCount() ==3) then addPoints = tonumber(addPoints[1]["Points"]) * 0.4
-
No, I want it only for Race deathmatch / destruction derby mode.
-
Thanks I will try it.I thought that was only for Racing mode but now I see it isn't.Thx
-
Hello all! I started to script simple points and ranks system.But I don't know a function to call when example there are 10 players in server and when you die first it gives you 0 pts, if you die second example 2 pts etc... Any idea all? It's for Race DM mode.
-
For the first error.I found in (almost) all GUI's.They have that little bug for the date yeah.
-
This is the final code from Achievements (serverside) local rootElement= getRootElement() addEvent("onPlayerFinish") function ResourceStart() executeSQLCreateTable("Achievments", "serial STRING,Ach1 INT") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), ResourceStart) function ClientReady(g_player) local serial = getPlayerSerial(g_player) local playername = getPlayerName(g_player) CheckPlayer = executeSQLSelect ( "Achievements", "serial", "serial = '" .. serial .. "'" ) if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then executeSQLInsert ( "Achievements", "'"..serial.."','0','0','0','0'" ) end end addEvent("onClientReady",true) addEventHandler("onClientReady",getRootElement(),ClientReady) -- Achievement #1 function Ach1(playeer) local playername = getPlayerName(playeer) local serial = getPlayerSerial(playeer) local Ach1 = executeSQLSelect ( "Achievments", "Ach1","serial = '" .. serial .. "'") Ach1 = tonumber(Ach1[1]["Ach1"]) + 1 if Ach1 == 1 then outputChatBox("**Achievments: "..playername.." unlocked the achievment 'Newb Racer' for winning 1 race! (5B)",getRootElement(),255,100,0) setElementData ( playeer ,"data.Ach1",Ach1,true) executeSQLUpdate ( "Achievments", "Ach1 = '"..Ach1.."'","serial = '" .. serial .. "'") end end function achUnlockedNumber(source) local serial = getPlayerSerial(source) local Ach1 = executeSQLSelect ( "Achievments", "Ach1","serial = '" .. serial .. "'") if tonumber(Ach1[1]["Ach1"]) >= 1 then U1 = 1 else U1 = 0 end end AchNumb = U1 setElementData(source,"data.Achnum",AchNumb,true) addEvent( "AchCount",true) addEventHandler( "AchCount", root,achUnlockedNumber ) function raceWin(rank) if rank ~= 1 then --Check if the player's rank is 1 return end local playername = getPlayerName(source) local serial = getPlayerSerial(source) triggerClientEvent (source,"onPlayerWin", getRootElement()) end setElementData(source,"data.playername",playername,true) if get("Achievments") == 'true' then Ach1(source) outputDebugString("justtesting") end addEventHandler("onPlayerFinish", rootElement, raceWin ) I was debugging it with ' /debugscript 3 ' and it said these 2 errors: Bad argument @ 'setElementData' (line 43) Bad argument @ 'setElementData' (line 52)
-
Hmm, I tried debugging "if's".But nothing... so I tried this code.Sorry if I'm mistaken. function raceWin(rank) if rank ~= 1 then --Check if the player's rank is 1 return end local playername = getPlayerName(source) local serial = getPlayerSerial(source) triggerClientEvent (source,"onPlayerWin", getRootElement()) end setElementData(source,"data.playername",playername,true) if get("Achievments") == 'true' then Ach1(source) outputDebugString("justtesting") end end
-
Please help anyone? (sry for double post)
-
Try to debug script in the server with '/debugscript 3 ' and see if there are any errors.
-
Yes and you can add column by this function: exports.scoreboard:addScoreboardColumn(") (I think) ^^
-
Ahhh... I'm totally sorry man
-
Than I'm sorry. (and what is wrong)
-
I had 2 stupid errors (like forgot to end the function) and I modified it now. (First post) But still when I finish race it outputs no errors but it gives no achievement.
-
Ok a very simple one. function startSQLOnStart() executeSQLCreateTable("Users", "Serial STRING") executeSQLCreateTable("EveryIDName", "ID INT") executeSQLCreateTable("XPosName", "XPos INT") executeSQLCreateTable("YPosName", "YPos INT") executeSQLCreateTable("ZPosName", "Zpos INT") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), startSQLOnStart) When you create table you can save things into it.
