proracer
Members- 
                
Posts
499 - 
                
Joined
 - 
                
Last visited
 
Everything posted by proracer
- 
	Hello, I studied the "race_starter_pack" resource from Mar and it's really complicated (for me).I gave it a try to make own achievements by looking at his functions.But it doesn't work of course.Can you check what's wrong please? Achievements (serverside) 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 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) end end Achievements (clientside) function clientAchievements() local AchNum = getElementData(getLocalPlayer(),"data.Achnum") end addEvent("clientAchievements",true) addEventHandler("clientAchievements",getRootElement(), clientAchievements) Main Achievements (clientside, show picture with achievement you got) local rootElement = getRootElement() local screenWidth, screenHeight = guiGetScreenSize() GUIEditor_Grid = {} GUIEditor_Image = {} function AchText() dxDrawText( "Achievment Unlocked",528,613,311,23, tocolor ( 192,192,192,255 ), 1.15, "default-bold","left","top", false, false ,true ) end addEvent( "onAchUnlock", true ) function onAchUnlock() addEventHandler("onClientRender",rootElement, AchT) setTimer(function() removeEventHandler("onClientRender",rootElement, AchT) end, 5000,1) addEventHandler("onClientRender",rootElement, AchText) setTimer(function() removeEventHandler("onClientRender",rootElement, AchText) end, 5000,1) GUIEditor_Grid[1] = guiCreateGridList(432,607,424,64,false) GUIEditor_Image[1]= guiCreateStaticImage(1,0,88,64,"images/unlocked.png",false,GUIEditor_Grid[1]) setTimer(function() guiSetVisible(GUIEditor_Grid[1],false) guiSetVisible(GUIEditor_Image[1],false) end, 5000,1) playSound("sounds/achievement.mp3") end addEventHandler( "onAchUnlock", rootElement, onAchUnlock) function AchT() dxDrawText( "5 B - Newb Racer", 528,640,376,34, tocolor ( 192,192,192,255 ), 1.15, "default-bold","left","top", false, false ,true ) end
 - 
	What do you mean by: 'Speed' function?
 - 
	This for example adds NOS to every player.Im a newb too, so sorry I didn't tested and I don't know if it works but try it. This is serverside script so remember to add "type = server" in meta.xml local root = getRootElement() function addNitrosOxygen(command) if (isPedInVehicle (root)) then local vehicleUpgrade = getPedOccupiedVehicle (root) local vehicleUpgraded = addVehicleUpgrade (theVehicle, 1010) if (vehicleUpgraded) then outputConsole ("Nitro added to all players.", root) end end end addCommandHandler ("addnitro", addNitrosOxygen)
 - 
	I thought if it's possible to use Hunter times for DM and also Race times for Race in the same time.Possible...?
 - 
	I tested but it doesn't work.
 - 
	So I was trying to make script which does, when you reach example 100 km/h it outputs some message. But I don't know how to create that part, when some player reaches some speed. I tried and this code, but ofcourse its not good. function getVehicleSpeed() speedx, speedy, speedz = getElementVelocity (getPedOccupiedVehicle(getLocalPlayer()) actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) if (actualspeed) = 100 then -- i know this isn't good, if you know please tell me. outputChatBox ("Nice speed man.") addEventHandler("onResourceStart", getResourceRootElement(getThisResource))
 - 
	Hello, I have downloaded recent Hunter Top Times.But now the server won't show race top times. Beacuse we have also Race,DD/Dm etc... How can I enable them both?
 - 
	Thanks for answers guys.
 - 
	I saw on some resources it supports new stylish GUI.I tried to find on MTA Community but I can't find it.It's downloadable anywhere?
 - 
	You can use this. https://wiki.multitheftauto.com/wiki/GetTimerDetails OR https://wiki.multitheftauto.com/wiki/GetTickCount But if you want timer to put on screen I think you should check how the "missiontimer" resource works. It's in your resources folder as default.
 - 
	I think it isn't hard is it?
 - 
	That is my question too .Sorry I really can't help you no further.I really don't know too.
 - 
	Im not sure if it's possible but you can modify the 3D Model (with 3D Studio Max or any similiar) of a certain marker type. Never did it so don't take my word.
 - 
	https://wiki.multitheftauto.com/wiki/CreateMarker - Quote from MTA Wiki.So there are 5 types of marker.
 - 
	Thanks alot.I have always problems with supplied arguments.
 - 
	---------------------------------- --SCRIPT MADE BY -[xXx]-Pr0RaC3R-- ---------------------------------- ---------------------------- --New Commands Version 1.0-- ---------------------------- ---------------------------- -- Command 1 --------------- ---------------------------- function addCommand1(commandName) local localPlayer = getPlayerName outputChatBox ( localPlayer.. "is now AFK.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("afk", addCommand1) ---------------------------- -- Command 2 --------------- ---------------------------- function addCommand2(commandName) local player123 = getPlayerName outputChatBox ( localPlayer.. " will be right back.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("brb", addCommand2) ---------------------------- -- Command 3 --------------- ---------------------------- function addCommand3(commandName) local localPlayer = getPlayerName outputChatBox ( localPlayer.. "thinks this was a good game.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("gg", addCommand3) ---------------------------- -- Command 4 --------------- ---------------------------- function addCommand4(commandName) local localPlayer = getPlayerName outputChatBox ( localPlayer.. "thinks this was a bad game.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("bg", addCommand4) ---------------------------- -- Command 5 --------------- ---------------------------- function addCommand5(commandName) local localPlayer = getPlayerName outputChatBox ( localPlayer.. "thinks that was unfair.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("unfair", addCommand5) When I type any command it gives me: "Attemp to concatenate local 'localPlayer' . I also tried to remove local variables and assign to 1 global variable like: player123 = getPlayerName But still nothing Sry people, I'm just a beginner EDIT: Sorry I just find that I didn't set any argument for "getPlayerName" but I don't know what argument to put. I put argument like: source,playerSource and still nothing.But the function is now global. NEW CODE: ---------------------------------- --SCRIPT MADE BY -[xXx]-Pr0RaC3R-- ---------------------------------- ---------------------------- --New Commands Version 1.0-- ---------------------------- player123 = getPlayerName(source) ---------------------------- -- Command 1 --------------- ---------------------------- function addCommand1(commandName) outputChatBox ( player123.. "is now AFK.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("afk", addCommand1) ---------------------------- -- Command 2 --------------- ---------------------------- function addCommand2(commandName) outputChatBox ( player123.. " will be right back.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("brb", addCommand2) ---------------------------- -- Command 3 --------------- ---------------------------- function addCommand3(commandName) outputChatBox ( player123.. "thinks this was a good game.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("gg", addCommand3) ---------------------------- -- Command 4 --------------- ---------------------------- function addCommand4(commandName) outputChatBox ( player123.. "thinks this was a bad game.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("bg", addCommand4) ---------------------------- -- Command 5 --------------- ---------------------------- function addCommand5(commandName) outputChatBox ( player123.. "thinks that was unfair.", getRootElement(), 255, 0, 0, true ) end addCommandHandler ("unfair", addCommand5) Problem is that is giving me a bad argument at line 9.
 - 
	You don't need to call setSoundVolume if you want highest volume because its default already. If I'm wrong, than sorry.
 - 
	Nice video but as previous post, yes too easy...
 - 
	Oh thanks man.Yeah forgot about corona.
 - 
	Ok so here is my code. local myMarker = createMarker ( -720,965,11.78,corona,3,255,0,0,255 ) function MarketHit ( hitElement, mathingDimension ) function removePedsHead(thePlayer) if getElementType (hitElement) == "player" then setPedHeadless(thePlayer, true) outputChatBox ("You lost your head.", thePlayer, 255, 140, 0) end end end addEventHandler ("onMarkerHit", myMarker, MarkerHit) I know this is wrong code as Im missing event for function:" removePedsHead".And I don't know where to put it. I want to know how can I register function:"removePedsHead".Because I saw on Wiki that there is only addComandHandler.So how can I register it for Event? I want that when some player enters the corona he becomes headless.
 - 
	How i can randomize the spawnpoint's vehicle in a map? Race or Freeroam? or what mode...
 - 
	I didn't but now when I put it it loads music file (3.4 mb) but won't play the sound when I press "Listen".
 - 
	So for test I created some simple Media Player with GUI Window and DX Lines and text.I wanna play a sound when someone clicks on: "Listen" but it doesn't. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() GUIEditor_Grid = {} showCursor(true,true) Local_Media_Player_Window = guiCreateWindow(536,120,806,637,"Local Media Player",false) guiWindowSetSizable(Local_Media_Player_Window,false) Listen_Button_1 = guiCreateButton(90,25,186,65,"Listen",false,Local_Media_Player_Window) addEventHandler( "onClientGUIClick", Listen_Button_1, listenButton1 ) end ) -- Direct X Drawing addEventHandler("onClientRender",root, function() dxDrawText("DJ Ravine - Listen to your heart",959.0,161.0,1330.0,251.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,false) dxDrawLine(538.0,252.0,1339.0,252.0,tocolor(255,255,255,255),1.0,false) dxDrawLine(940.0,141.0,940.0,754.0,tocolor(255,255,255,255),1.0,false) end ) function listenButton1 (button) if button == "left" then local sound = playSound("sounds/sound1.mp3") --Play sound setSoundVolume(sound, 0.75) end end That is the code.By the way I hope I put sound correctly.I made folder in "LocalMediaPlayer" resource and in "sounds" folder there is "sound1.mp3".MTA Script Editor outputs no errors.
 - 
	Thx for this but can you please put comments because I don't just want script, I wanna learn.I wanna understand why is that .Thx for help
 
