S3Nn4oX Posted October 31, 2016 Share Posted October 31, 2016 (edited) I have a problem with my code, it doesn't show the messages when I type /troll <someonenotexists> it doesn't send me a message and it doesn't do the function, No debug errors,warnings function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function CRC_MAIN( cmd, thePlayer ,who, targetPlayer, sourcePlayer) setTimer ( CRC_MAIN, 10000, 0 ) if thePlayer and isElement(thePlayer) and getElementType ( thePlayer ) == 'player' then local targetPlayer = getPlayerFromPartialName ( who ) local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) local aPlayer = isPedInVehicle ( targetPlayer ) and getPedOccupiedVehicle ( targetPlayer ) or thePlayer if isPedInVehicle(thePlayer) then if targetPlayer then if aPlayer then outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFThe Player #FFFFFFTrolling!", sourcePlayer, 255, 0, 0, true) outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFif you want to troll someone You've to wait 1 minute, to use the command again.", sourcePlayer, 255, 0, 0, true) setVehicleColor(targetPlayer, r, g, b) else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFThe Player #FFFFFFis not in a Vehicle.", sourcePlayer, 255, 0, 0, true) end else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFThe Player #FFFFFFDoesn't exists.", sourcePlayer, 255, 0, 0, true) end else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFYou must be in a vehicle to troll someone", sourcePlayer, 255, 0, 0, true) end end end addCommandHandler("troll", CRC_MAIN) function untroll( cmd, who, thePlayer ) local targetPlayer = getPlayerFromPartialName ( who ) if isPedInVehicle( targetPlayer ) then if targetPlayer then if isPedInVehicle(targetPlayer) then setVehicleColor (targetPlayer, 255,255,255) else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFThe Player #FFFFFFis not in a Vehicle.", thePlayer, 255, 0, 0, true) end else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFThe Player #FFFFFFDoesn't exists.", thePlayer, 255, 0, 0, true) end else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFYou must be in a vehicle to troll someone", thePlayer, 255, 0, 0, true) end end addCommandHandler("untroll", untroll) function firstMessage() outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFHas Loaded, /troll <playerName> to troll someone in a Vehicle. ", thePlayer, 255, 0, 0, true) end addEventHandler("onResourceStart", root, firstMessage) Thanks. Edited October 31, 2016 by S3Nn4oX Link to comment
Abdul KariM Posted October 31, 2016 Share Posted October 31, 2016 Use this function CRC_MAIN( cmd, thePlayer ,who, targetPlayer, sourcePlayer) setTimer ( CRC_MAIN, 10000, 0 ) if thePlayer and ( getPlayerFromName ( thePlayer ) ) then if not ( who ) then return end if not ( sourcePlayer ) or not( getPlayerFromName ( sourcePlayer ) ) then return end local targetPlayer = getPlayerFromPartialName ( who ) local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) local aPlayer = isPedInVehicle ( targetPlayer ) and getPedOccupiedVehicle ( targetPlayer ) or getPlayerFromName ( thePlayer ) if isPedInVehicle(getPlayerFromName ( thePlayer )) then if targetPlayer then if aPlayer then outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFThe Player #FFFFFFTrolling!", getPlayerFromName ( sourcePlayer ), 255, 0, 0, true) outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFif you want to troll someone You've to wait 1 minute, to use the command again.", getPlayerFromName ( sourcePlayer ), 255, 0, 0, true) setVehicleColor(getPedOccupiedVehicle ( targetPlayer ), r, g, b) else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFThe Player #FFFFFFis not in a Vehicle.", getPlayerFromName ( sourcePlayer ), 255, 0, 0, true) end else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFThe Player #FFFFFFDoesn't exists.", getPlayerFromName ( sourcePlayer ), 255, 0, 0, true) end else outputChatBox("#3d87ffCRC By @SpRoXx #FFFFFFYou must be in a vehicle to troll someone", getPlayerFromName ( sourcePlayer ), 255, 0, 0, true) end end end addCommandHandler("troll", CRC_MAIN) and say player name in f8 ex : troll abdulKarim ali yaser and Please interpreted what want do and Even i give you edit your request 1 Link to comment
S3Nn4oX Posted October 31, 2016 Author Share Posted October 31, 2016 Alright, it doesn't working I don't see the messages when I type /troll S3Nn4oXx(My Nick Name) it doesn't say the error, no debug .. Link to comment
Castillo Posted October 31, 2016 Share Posted October 31, 2016 What exactly are you trying to do? change the target player vehicle color every 10s? Link to comment
S3Nn4oX Posted November 3, 2016 Author Share Posted November 3, 2016 On 10/31/2016 at 11:46 PM, Solidsnake14 said: What exactly are you trying to do? change the target player vehicle color every 10s? I was trying to change someone vehicle color every 1 second but I fixed it. thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now