- 
                
Posts
4,961 - 
                
Joined
 - 
                
Last visited
 
Everything posted by Jaysds1
- 
	You could compile them with LUAC: viewtopic.php?f=108&t=33905 or delete them when they're transferred to the client: viewtopic.php?f=148&t=43499 viewtopic.php?f=148&t=36847
 - 
	try this: addEventHandler("onClientGUIClick",guiRoot, function () money = getPlayerMoney (localPlayer) if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then if (money >= 100) then outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",getLocalPlayer(),give45) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then if (money >= 200) then outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",getLocalPlayer(),givesilenced) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then if (money >= 600) then outputChatBox ("You bought a Desert Eagle $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("givedeagle",getLocalPlayer(),givedeagle) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[4]) then if (money >= 500) then outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",getLocalPlayer(),givesh) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then if (money >= 700) then outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",getLocalPlayer(),giveso) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then if (money >= 1000) then outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",getLocalPlayer(),giveSP) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then if (money >= 400) then outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",getLocalPlayer(),givetec) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then if (money >= 600) then outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",getLocalPlayer(),giveuzi) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then if (money >= 800) then outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",getLocalPlayer(),givemp5) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then if (money >= 1000) then outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",getLocalPlayer(),giveak) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then if (money >= 2000) then outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",getLocalPlayer(),givem4) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then if (money >= 3000) then outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",getLocalPlayer(),gives) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then if (money >= 1000) then outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",getLocalPlayer(),givecs) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) then if getPlayerMoney( localPlayer ) >= 1000 outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) elseif getElementHealth( localPlayer ) ~= 100 then outputChatBox('Your Health is 100% You Cant Buy MedKit',source,255,255,0) end elseif (source == GUIEditor_Button[26]) then if getPlayerMoney( localPlayer ) >= 1000 outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) elseif getPedArmor ( localPlayer ) ~= 100 then outputChatBox('Your Armor is Alredy 100% You Cant Buy Armor',source,255,255,0) end elseif (source == GUIEditor_Button[29]) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) end end,true)
 - 
	so, is the issue fixed?
 - 
	Sorry, this is a basic script, anyone could make it(if they have some knowledge of Lua).
 - 
	Sorry, Please read this topic for more info on Lua: viewtopic.php?f=148&t=40809
 - 
	Those aren't commands, they're suppose to be in a script...
 - 
	ok, When you start a script you could do a check with the function to see if the db is created, if it's not created then you could use a function to create it, here's some MTA functions: dbPoll dbConnect dbExec dbQuery dbFree
 - 
	EDIT: Sorry, I just looked through the code again, try this: addEventHandler ( "onColShapeHit" , LSPDColShape , function ( hElement ) outputChatBox("Col has been hitted", 255, 255, 255) if getElementType ( hElement ) ~= "player" then --returns a string return end if getPlayerWantedLevel ( hElement ) < 1 then return end if not getElementData ( hElement , "Cuffed" ) then return end local player = getPlayerFromName ( hElement ) --What's this? your getting the player name and trying to get the player data if not player then return end local cuffer = getElementData ( hElement , "Handcuffer" ) if not cuffer then return end local wantedLevel = getPlayerWantedLevel ( hElement ) fadeCamera(hElement, false) setTimer(setElementInterior, 1000, 1, hElement, 6) setTimer(setElementPosition, 1000, 1, hElement, 265.21185302734, 77.63591003418, 1001.0390625 ) setTimer(fadeCamera, 1000, 1, hElement, true) if settingTakePlayerWeaponsOnArrest then --What's this? takeAllWeapons(hElement) end setElementData(hElement, "Arrested", true) setElementData(hElement, "Cuffed", false) setElementData(hElement, "Handcuffer", "") if wantedLevel == 1 then givePlayerMoney(player, 1000) takePlayerMoney(hElement, 5000) setElementData(hElement, "Timeleft", 30) setTimer ( releasePlayer , 30000 , 1 , hElement ) elseif wantedLevel == 2 then givePlayerMoney(player, 2000) takePlayerMoney(hElement, 8000) setElementData(hElement, "Timeleft", 60) setTimer ( releasePlayer , 60000 , 1 , hElement ) elseif wantedLevel == 3 then givePlayerMoney(player, 3000) takePlayerMoney(hElement, 10000) setElementData(hElement, "Timeleft", 120) setTimer ( releasePlayer , 120000 , 1 , hElement ) elseif wantedLevel == 4 then givePlayerMoney(player, 4000) takePlayerMoney(hElement, 12000) setElementData(hElement, "Timeleft", 180) setTimer ( releasePlayer , 180000 , 1 , hElement ) elseif wantedLevel == 5 then givePlayerMoney(player, 5000) takePlayerMoney(hElement, 15000) setElementData(hElement, "Timeleft", 200) setTimer ( releasePlayer , 200000 , 1 , hElement ) elseif wantedLevel == 6 then givePlayerMoney(player, 8000) takePlayerMoney(hElement, 20000) setElementData(hElement, "Timeleft", 240) setTimer ( releasePlayer , 240000 , 1 , hElement ) end setPlayerWantedLevel(hElement, 0) end )
 - 
	np lol, I know...
 - 
	Easy: g_Root = getRootElement() function Initiate() country = getPlayerCountry(source) if country == nil or country == false then country = "n/a" end setElementData(source, "country", country) end addEventHandler('onPlayerJoin', g_Root, Initiate) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() -- You can remove this if you want outputChatBox('#ffffff[bemVindo] #ffff00Divirtam-se #ffffffDONE', getRootElement(), 255, 100, 100, true) call(getResourceFromName("scoreboard"),"addScoreboardColumn","Country", getRootElement(), 9, 50) setTimer( function() country = getPlayerCountry(source) if country == nil or country == false then country = "n/a" end setElementData(source, "country", country) end, 4000, 1) end ) aCountries = {} function getPlayerCountry ( player ) return getIpCountry ( getPlayerIP ( player ) ) end function getIpCountry ( ip ) local ip_group = tonumber ( gettok ( ip, 1, 46 ) ) local ip_code = ( gettok ( ip, 1, 46 ) * 16777216 ) + ( gettok ( ip, 2, 46 ) * 65536 ) + ( gettok ( ip, 3, 46 ) * 256 ) + ( gettok ( ip, 4, 46 ) ) if ( #aCountries == 0 ) then loadIPGroups () end if ( not aCountries[ip_group] ) then aCountries[ip_group] = {} end for id, group in ipairs ( aCountries[ip_group] ) do if ( ( group.rstart <= ip_code ) and ( ip_code <= group.rend ) ) then return group.rcountry end end return false end -- Load all IP groups from "conf/IpToCountryCompact.csv" function loadIPGroups () unrelPosReset() local readFilename = "conf/IpToCountryCompact.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputHere ( "Cannot read " .. readFilename ) return end local buffer = "" while true do local endpos = string.find(buffer, "\n") -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) local parts = split( line, string.byte(',') ) if #parts > 2 then local rstart = tonumber(parts[1]) local rend = tonumber(parts[2]) local rcountry = parts[3] -- Relative to absolute numbers rstart = unrelRange ( rstart ) rend = unrelRange ( rend ) local group = math.floor( rstart / 0x1000000 ) if not aCountries[group] then aCountries[group] = {} end local count = #aCountries[group] + 1 aCountries[group][count] = {} aCountries[group][count].rstart = rstart aCountries[group][count].rend = rend aCountries[group][count].rcountry = rcountry end end end fileClose(hReadFile) end -- Make a stream of absolute numbers relative to each other local relPos = 0 function relPosReset() relPos = 0 end function relRange( v ) local rel = v - relPos relPos = v return rel end -- Make a stream of relative numbers absolute local unrelPos = 0 function unrelPosReset() unrelPos = 0 end function unrelRange( v ) local unrel = v + unrelPos unrelPos = unrel return unrel end -- IP2C logging function outputHere( msg ) --outputServerLog ( msg ) outputChatBox ( msg ) end ---------------------------------------------------------------------------------------- -- -- Set to true to enable commands "makecsv" and "iptest" -- ---------------------------------------------------------------------------------------- local makeAndTestCompactCsv = false if makeAndTestCompactCsv then local makeCor -- Takes a 'IPV4 CSV' file sourced from [url=http://software77.net/geo-ip/]http://software77.net/geo-ip/[/url] -- and makes a smaller one for use by Admin addCommandHandler ( "makecsv", function () local status = makeCor and coroutine.status(makeCor) if (status == "suspended") then outputHere( "Please wait" ) return end makeCor = coroutine.create ( makeCompactCsvWorker ) coroutine.resume ( makeCor ) end ) function makeCompactCsvWorker () outputHere ( "makeCompactCsv started" ) relPosReset() local readFilename = "conf/IpToCountry.csv"; local hReadFile = fileOpen( readFilename, true ) if not hReadFile then outputHere ( "Cannot read " .. readFilename ) return end local writeFilename = "conf/IpToCountryCompact.csv"; local hWriteFile = fileCreate( writeFilename, true ) if not hWriteFile then fileClose(hReadFile) outputHere ( "Cannot create " .. writeFilename ) return end local tick = getTickCount() local buffer = "" while true do if ( getTickCount() > tick + 50 ) then -- Execution exceeded 50ms so pause and resume in 50ms setTimer(function() local status = coroutine.status(makeCor) if (status == "suspended") then coroutine.resume(makeCor) elseif (status == "dead") then makeCor = nil end end, 50, 1) coroutine.yield() tick = getTickCount() end local endpos = string.find(buffer, "\n") -- If can't find CR, try to load more from the file if not endpos then if fileIsEOF( hReadFile ) then break end buffer = buffer .. fileRead( hReadFile, 500 ) end if endpos then -- Process line local line = string.sub(buffer, 1, endpos - 1) buffer = string.sub(buffer, endpos + 1) -- If not a comment line if string.sub(line,1,1) ~= '#' then -- Parse out required fields local _,_,rstart,rend,rcountry = string.find(line, '"(%w+)","(%w+)","%w+","%w+","(%w+)"' ) if rcountry then -- Absolute to relative numbers rstart = relRange( rstart ) rend = relRange( rend ) -- Output line fileWrite( hWriteFile, rstart .. "," .. rend .. "," .. rcountry .. "\n" ) end end end end fileClose(hWriteFile) fileClose(hReadFile) outputHere ( "makeCompactCsv done" ) end function ipTestDo( ip ) local country = getIpCountry ( ip ) outputHere ( "ip " .. ip .. " is in " .. tostring(country) ) end function ipTest() ipTestDo ( "46.1.2.3" ) ipTestDo ( "88.1.2.3" ) ipTestDo ( "46.208.74.201" ) ipTestDo ( "102.1.2.3" ) end
 - 
	Do you mean when the player has the weapon the image is shown?
 - 
	ok, try this: function morir () local SkinID = getElementModel( client ) triggerClientEvent(source,"spawng",source) spawnPlayer ( client, 1607.4176025391, 1816.3229980469, 10.8203125 ) setElementModel( client,SkinID) end addEventHandler ("onPlayerWasted", root, morir)
 - 
	I know you can't put an image in a GridList, so you could try putting the image somewhere on the tab
 - 
	Can you send me your IP (and pass) through pm?
 - 
	Sorry, I don't see any image funciton in your script, and here: tab2 = guiCreateTab("Weapons",tabPanel) weapGrid = guiCreateGridList(4,6,305,291,false,tab2) guiGridListSetSelectionMode(weapGrid,0) weapColumn = guiGridListAddColumn(weapGrid,"Weapon",0.5) costColumn = guiGridListAddColumn(weapGrid,"$",0.3) weapButton = guiCreateButton(107,308,100,29,"Buy Weapon",false,tab2) local weapons = {{31,3500},{4,15000},{22,2500},{23,2700},{24,4000},{25,4200},{26,9000},{27,8000},{28,6500},{29,7000},{30,3500},{32,7800},{33,11000},{34,16000},{16,20000}} for i,v in ipairs (weapons) do guiGridListSetItemText (weapGrid, guiGridListAddRow (weapGrid), 1, getWeaponNameFromID (v[1]), false, false) guiGridListSetItemText (weapGrid, guiGridListAddRow (weapGrid), 2, tostring(v[2]), false, false) end guiSetAlpha(weapGrid,1)
 - 
	
	
				[Trailer] MTA:SA TwinGold Roleplay Official Trailer
Jaysds1 replied to Jack_White(Gundi)'s topic in Media
Nice, It was very planned - 
	try this, Server: createBlip ( 1036.1654052734, -1027.8570556641, 32.1015625, 27 ) function createMechanicTeam () mecTeam = createTeam ("Mechanic", 255, 153, 0) end addEventHandler ("onResourceStart", resourceRoot, createMechanicTeam) function joinMec() setPlayerTeam(client,mecTeam) setElementModel(client, 50) giveWeapon ( client, 42, 999 ) setElementData( client, "Occupation", "Mechanic") outputChatBox("You are now a Mechanic.",client,0,255,0) end addEvent("setMec", true) addEventHandler("setMec", root, joinMec ) addEvent("mechanic:repair", true) addEventHandler("mechanic:repair", root,function(mechanic) if (getElementHealth(source) < 100) then local Heal = getElementHealth(source) + 10 -- New health setElementHealth(source, Heal) if (Heal > 100) then setElementHealth(source, 1000) end givePlayerMoney(mechanic, 1000) -- Gives 100$ to the medic each time the function is executed end end) Client: local marker = createMarker( 1037.8309326172, -1029.5063476563, 31.1015625, "Cylinder", 1.5, 255, 153, 0, 150) --- marker createMarker ( float x, float y, float z, [string theType, float size, int r, int g, int b, int a] ) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"Mchanic job") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Mechanic job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take mechanic job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiMemoSetReadOnly(GUIEditor_Memo[1],true) --It's a memo not an edit function Mecjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, Mecjob) function Mecjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, Mecjobleave) function joinTeam() triggerServerEvent("setMec",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeMedicWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeMedicWindow, false) addEventHandler("onClientPlayerDamage",root,function()function(attacker, weapon, bodypart, loss) local localVehicle = getPedOccupiedVehicle(source) team = getPlayerTeam(attacker) if (attacker and getElementType(attacker) == "player" and weapon == 42 and team and getTeamName(team) == "Mechanic") then cancelEvent() -- Cancels the damage cause by the spray if (not isTimer(pause)) then if (health <= 99) then triggerServerEvent("mechanic:repair", localVehicle, attacker) -- Calls the Server Event pause = setTimer(function() end, 1000, 1) -- Makes a timer for the function so it won't fully heal in the first time end end end end)
 - 
	lol, try this: addEventHandler("onPlayerJoin",root,function() -- There's no parameters local decoration = "================================================" outputChatBox(" "..decoration.." ",source, 38, 98, 188, true) -- You need to end the quote then add the string you want, or just put the variable instead of the quotes outputChatBox("#ffffffWelcome to #2662bc=(RfC)= #ffffffserver", source, 38, 98, 188, true) outputChatBox("#ffffffDon't forgot to visit our webiste!", source, 38, 98, 188, true) outputChatBox("#848484www.website.eu", source, 38, 98, 188, true) outputChatBox(" ".. decoration .." ", source, 38, 98, 188, true) end end)
 - 
	ok, Did the code work?
 - 
	isn't the guiElement the name of the animation? The guiGridListGetSelectedItem returns 2 intergers, so, no that's not the right syntax
 - 
	Can you pm me the server, so I can go on it? EDIT: It's fixed
 - 
	try it again, I've edited it, BTW, When's this triggered?
 
