-
Posts
1,491 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Walid
-
try to do it by yourself then post your code here
-
ah sorry i forgot to change the function name to nyanCommand. -- from addCommandHandler ( "fools", foolsCommand ) --To addCommandHandler ( "fools", nyanCommand ) that's all -- Server side function nyanCommand ( playerSource, commandName ) local acc = getPlayerAccount (playerSource) if acc and not isGuestAccount(acc) then local accName = getAccountName (acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local theTriggerer = getPlayerName ( playerSource ) if commandName == "nyan" then triggerClientEvent (playerSource, "playMusicEvent", playerSource,"nyan" ) outputChatBox ( theTriggerer .. "#E45800 Is a Nyan Cat !", getRootElement(), 255, 255, 255, true ) elseif commandName == "fools" then triggerClientEvent (playerSource, "playMusicEvent", playerSource,"fools" ) outputChatBox ( theTriggerer .. "#E45800 Is Killing Fools!", getRootElement(), 255, 255, 255, true ) end end end end addCommandHandler ( "nyan", nyanCommand ) addCommandHandler ( "fools", nyanCommand) -- Client side function playMusic (songName) if sound and isElement(sound) then stopSound(sound) end if songName == "nyan" then sound = playSound("Nyan.mp3") elseif soungName == "fools" then sound = playSound("Killingfools.mp3") end setSoundVolume(sound, 1) end addEvent("playMusicEvent", true ) addEventHandler("playMusicEvent", getRootElement(), playMusic )
-
triggerClientEvent ( [table/element sendTo=getRootElement()], string name, element sourceElement, [arguments...] ) Example local text = "bla bla bla" triggerClientEvent ( client, "EventName",client, text)
-
Wiki account : Walid
-
add end at the end of your code. Example: -- Server side function nyanCommand ( playerSource, commandName ) local acc = getPlayerAccount (playerSource) if acc and not isGuestAccount(acc) then local accName = getAccountName (acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local theTriggerer = getPlayerName ( playerSource ) if commandName == "nyan" then triggerClientEvent (playerSource, "playMusicEvent", playerSource,"nyan" ) outputChatBox ( theTriggerer .. "#E45800 Is a Nyan Cat !", getRootElement(), 255, 255, 255, true ) elseif commandName == "fools" then triggerClientEvent (playerSource, "playMusicEvent", playerSource,"fools" ) outputChatBox ( theTriggerer .. "#E45800 Is Killing Fools!", getRootElement(), 255, 255, 255, true ) end end end end addCommandHandler ( "nyan", nyanCommand ) addCommandHandler ( "fools", nyanCommand) -- Client side function playMusic (songName) if sound and isElement(sound) then stopSound(sound) end if songName == "nyan" then sound = playSound("Nyan.mp3") elseif soungName == "fools" then sound = playSound("Killingfools.mp3") end setSoundVolume(sound, 1) end addEvent("playMusicEvent", true ) addEventHandler("playMusicEvent", getRootElement(), playMusic ) sorry i'm using my phone.
-
acc it's not defined in your code. add this line local acc = getPlayerAccount(playerSource) and replace source with playerSource. also you need to check if the player isLogged in or not if acc and not isGuestAccount(acc) then -- Your code end
-
lol i mean you need to use string.gsub to remove the ($ and , ) before you buy something. Example: local text = "$5000" string.gsub(text,"$"," ")
-
you need to use string.gsub()
-
Note: To save client CPU, you should avoid setting sourceElement to the root element where possible. Using resourceRoot is usually sufficient if the event is handled by the same resource on the client. addEventHandler ( "onPickupHit", pickup, function( hitPlayer ) if (hitPlayer and getElementType ( hitPlayer ) == 'player' and not isPedInVehicle (hitPlayer) ) then triggerClientEvent(hitPlayer,"show", hitPlayer) end end)
-
the problem is you don't need to use localPlayer with getPlayerMoney. just put it like this local money = getPlayerMoney()
-
Check the key names on the wiki page . Example : mouse1 or space
-
i don't undrestand nothing explaine your problem better there is no timer in your code. also 3 minutes = 180000 milliseconds you can't use the number 3 show me the code where you stored the elementData "alivetime".
-
open your use i already gave you the solution. example: -- sortedTopSniper[1][1] : sinper name -- sortedTopSniper[1][2] : Number of kill
-
local snipers = {} -- snipers table addEventHandler("onPlayerWasted",getRootElement(), function ( ammo, attacker, weapon, bodypart ) if attacker and getElementType ( attacker ) == "player" and attacker ~= source then if tonumber(weapon) == 34 then snipers[attacker] = (snipers[attacker] or 0) + 1 end end end ) -- Table sort function topSniper() sortedTopSniper = {} for a, b in pairs(snipers) do table.insert(sortedTopSniper, {getPlayerName(a), b}) end table.sort(sortedTopSniper, function(a,b) return a[2] > b[2] end) end
-
addEventHandler( "onPlayerWasted", root, function( _, killer ) if killer and getElementType(killer) == "player" and killer ~= source then local alivetime = getElementData( source, "alivetime" ) or 0 local name = getPlayerName( killer ) if tonumber( alivetime ) > 3 then outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) else outputChatBox( "Playerul #ffffff"..name.."#ff0000 este suspectat de spawnkill!", root, 255, 0, 0,true ) end end end )
-
You don't need to do all fo this simply it can be like this. local dlGroups = { "DL1", "DL2", "DL3"}; addEventHandler ( "onPlayerLogin", root, function ( _, theAccount ) for a, g in ipairs (dlGroup) do if ( isObjectInACLGroup ( "user."..getAccountName(theAccount) , aclGetGroup (g))) then setElementData (source, "CSThit", "DL"..a) return; end end end );
-
Read this Call
-
As far as i know there is an export function to destroy custom blips all what you need is: isCustomBlipVisible -- check if the custom blip is visible or not. destroyCustomBlip -- then destroy it.
-
post full code here , as i can see criminalBlip it's not defined in your code.
-
^ You can't remove login command using removeCommandHandler.
-
Try to use table.sort i will gave an example: -- get all players inside database function getAllPlayersInsideDataBase() local data = dbPoll(dbQuery(dbYhteys,"SELECT * FROM kayttajat"), -1) return data end -- Now you need to use table.sort function topRichestsPlayers() sortedTopRichestsPlayers = {} local table = getAllPlayersInsideDataBase() for a, b in pairs(table) do table.insert(sortedTopRichestsPlayers, {a, b}) end table.sort(sortedTopRichestsPlayers , function(a,b) return a[2] > b[2] end) end
-
show me your items table.