isa_Khamdan Posted August 4, 2013 Share Posted August 4, 2013 Hello , I have an Anti insult script and it's working fine but the only problem is that it keep repeating text for example when ( Nexus: Hi , Nexus: Hi ) it keep repeating all messages so someone told me that you can edit it from the freeroam to stop it from repeating so can anyone tell me how to do that? ---Fr_Server g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_PlayerData = {} g_VehicleData = {} local chatTime = {} local lastChatMessage = {} g_ArmedVehicles = { [425] = true, [447] = true, [520] = true, [430] = true, [464] = true, [432] = true } g_Trailers = { [606] = true, [607] = true, [610] = true, [590] = true, [569] = true, [611] = true, [584] = true, [608] = true, [435] = true, [450] = true, [591] = true } g_RPCFunctions = { addPedClothes = { option = 'clothes', descr = 'Modifying clothes' }, addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, fadeVehiclePassengersCamera = true, fixVehicle = { option = 'repair', descr = 'Repairing vehicles' }, giveMeVehicles = { option = 'createvehicle', descr = 'Creating vehicles' }, giveMeWeapon = { option = 'weapons.enabled', descr = 'Getting weapons' }, givePedJetPack = { option = 'jetpack', descr = 'Getting a jetpack' }, killPed = { option = 'kill', descr = 'Killing yourself' }, removePedClothes = { option = 'clothes', descr = 'Modifying clothes' }, removePedFromVehicle = true, removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' }, removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' }, setElementPosition = true, setElementInterior = true, setMyGameSpeed = { option = 'gamespeed.enabled', descr = 'Setting game speed' }, setMySkin = { option = 'setskin', descr = 'Setting skin' }, setPedAnimation = { option = 'anim', descr = 'Setting an animation' }, setPedFightingStyle = { option = 'setstyle', descr = 'Setting fighting style' }, setPedGravity = { option = 'gravity.enabled', descr = 'Setting gravity' }, setPedStat = { option = 'stats', descr = 'Changing stats' }, setTime = { option = 'time.set', descr = 'Changing time' }, setTimeFrozen = { option = 'time.freeze', descr = 'Freezing time' }, setVehicleColor = true, setVehicleHeadLightColor = true, setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' }, setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' }, setVehicleRotation = true, setWeather = { option = 'weather', descr = 'Setting weather' }, spawnMe = true, warpMe = { option = 'warp', descr = 'Warping' } } g_OptionDefaults = { alpha = true, anim = true, clothes = true, createvehicle = true, gamespeed = { enabled = true, min = 0.0, max = 3 }, gravity = { enabled = true, min = 0, max = 0.1 }, jetpack = true, kill = true, lights = true, paintjob = true, repair = true, setskin = true, setstyle = true, spawnmaponstart = true, spawnmapondeath = true, stats = true, time = { set = true, freeze = true }, upgrades = true, warp = true, weapons = { enabled = true, vehiclesenabled = true, disallowed = {} }, weather = true, welcometextonstart = true, vehicles = { maxidletime = 60000, idleexplode = true, maxperplayer = 2, disallowed = {} } } function getOption(optionName) local option = get(optionName:gsub('%.', '/')) if option then if option == 'true' then option = true elseif option == 'false' then option = false end return option end option = g_OptionDefaults for i,part in ipairs(optionName:split('.')) do option = option[part] end return option end addEventHandler('onResourceStart', g_ResRoot, function() table.each(getElementsByType('player'), joinHandler) end ) function joinHandler(player) if not player then player = source end local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255) setPlayerNametagColor(player, r, g, b) g_PlayerData[player] = { vehicles = {} } g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b) if g_FrozenTime then clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather) end if getOption('welcometextonstart') then outputChatBox('Welcome to Freeroam', player, 0, 255, 0) outputChatBox('Press F1 to show/hide controls', player, 0, 255, 0) end end addEventHandler('onPlayerJoin', g_Root, joinHandler) addEvent('onLoadedAtClient', true) addEventHandler('onLoadedAtClient', g_ResRoot, function(player) if getOption('spawnmaponstart') and isPedDead(player) then clientCall(player, 'showWelcomeMap') end end, false ) addEventHandler('onPlayerWasted', g_Root, function() if not getOption('spawnmapondeath') then return end local player = source setTimer( function() if isPedDead(player) then clientCall(player, 'showMap') end end, 2000, 1 ) end ) addEvent('onClothesInit', true) addEventHandler('onClothesInit', g_Root, function() local result = {} local texture, model -- get all clothes result.allClothes = {} local typeGroup, index for type=0,17 do typeGroup = {'group', type = type, name = getClothesTypeName(type), children = {}} table.insert(result.allClothes, typeGroup) index = 0 texture, model = getClothesByTypeIndex(type, index) while texture do table.insert(typeGroup.children, {id = index, texture = texture, model = model}) index = index + 1 texture, model = getClothesByTypeIndex(type, index) end end -- get current player clothes { type = {texture=texture, model=model} } result.playerClothes = {} for type=0,17 do texture, model = getPedClothes(source, type) if texture then result.playerClothes[type] = {texture = texture, model = model} end end triggerClientEvent(source, 'onClientClothesInit', source, result) end ) addEvent('onPlayerGravInit', true) addEventHandler('onPlayerGravInit', g_Root, function() triggerClientEvent('onClientPlayerGravInit', source, getPedGravity(source)) end ) function setMySkin(skinid) if isPedDead(source) then local x, y, z = getElementPosition(source) if isPedTerminated(source) then x = 0 y = 0 z = 3 end local r = getPedRotation(source) local interior = getElementInterior(source) spawnPlayer(source, x, y, z, r, skinid) setElementInterior(source, interior) setCameraInterior(source, interior) else setElementModel(source, skinid) setElementHealth(source, 100) end setCameraTarget(source, source) setCameraInterior(source, getElementInterior(source)) end function spawnMe(x, y, z) if not x then x, y, z = getElementPosition(source) end if isPedTerminated(source) then repeat until spawnPlayer(source, x, y, z, 0, math.random(9, 288)) else spawnPlayer(source, x, y, z, 0, getPedSkin(source)) end setCameraTarget(source, source) setCameraInterior(source, getElementInterior(source)) end function warpMe(targetPlayer) Link to comment
isa_Khamdan Posted August 4, 2013 Author Share Posted August 4, 2013 Well the problem isn't from the freeroam I stopped the freeroam but I am still having the same problem Here is the script I am using Server side -- DISCLAIMER --[[ Any user of this resource is allowed to modify the code for personal use, and are not allowed to share their own version with people. Do not attempt to resell this resource as it is avaiblable for FREE. Anyone caught breaking the disclamer will find themselves in trouble with the law under the Copyright Act 2008. You may use / edit only for PERSONAL USE. This code is copyrighted to Christopher Graham Smith (Urangan, Queensland, AUS). ]] -- Settings - These settings will change the scripts functions and allow you to disable certain parts. settings = { ['enableTeamChat'] = true, ['adminTag'] = { ['enabled'] = true, ['ACL'] = { -- A bit more advanced. { 'Fallen Army', ' ' }, { 'Everyone', ' ' } } }, ['swearFilter'] = { ['enabled'] = true, ['swearCost'] = 0, ['swears'] = { -- Allows you to set the blocked swear words, syntax is ['Insult'] = 'REPLACEMENT' ['حيآكم'] = 'سبحان الله', ['gay'] = 'Insult not allowed.' } }, ['antiSpamFilter'] = { ['enabled'] = true, ['execeptionGroups'] = 'Admin', -- Groups which can spam, eg. 'Admin,SuperModerator,Moderator' ['chatTimeOut'] = 1.5 -- Set in seconds. }, ['freezeChat'] = { ['enabled'] = true, ['command'] = 'freezechat', -- Command to use when activating frozen chat. ['allowedGroups'] = 'Admin,SuperModerator', -- Groups which have access to this command. ['resetTime'] = 5 -- Time in minutes before it automatically resets. }, ['clearChat'] = { ['enabled'] = true, ['command'] = 'clearchat', ['allowedGroups'] = 'Admin,SuperModerator' } } -- Required variables spam = { } stopChat = false function chatbox(message, msgtype) if stopChat then cancelEvent() outputChatBox('#FF0000[FREEZECHAT] #FFFFFFAn admin has recently frozen chat.', source, 255, 255, 255, true) return end local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local serial = getPlayerSerial(source) local r, g, b = getPlayerNametagColor(source) local text = message:gsub("%a", string.upper, 1) local check = 0 local spamCheck = false if settings['swearFilter']['enabled'] then for i, v in pairs(settings['swearFilter']['swears']) do while text:lower():find(i:lower(),1,true) do local start, end_ = text:lower():find(i:lower(),1,true) local found = text:sub(start,end_) text = text:gsub(found,v) if settings['swearFilter']['swearCost'] ~= 0 then takePlayerMoney(source, settings['swearFilter']['swearCost']) end end end end if msgtype == 0 then cancelEvent() if not settings['adminTag']['enabled'] and not spam[serial] then message = RGBToHex(r, g, b) .. name .. ':#FFFFFF ' .. text if 128 <= #message then outputChatBox('#FF0000Error: The message you entered is too big, please lower it!', source, 255, 255, 255, true) else outputChatBox(message, getRootElement(), 255, 255, 255, true) aclgroup = split(settings['antiSpamFilter']['execeptionGroups'], ', ') or settings['antiSpamFilter']['execeptionGroups'] for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v)) then spamCheck = true end end if not spamCheck then if settings['antiSpamFilter']['enabled'] then spam[serial] = true setTimer(function() spam[serial] = false end, settings['antiSpamFilter']['chatTimeOut']*1000, 1) end end outputServerLog('CHAT: ' .. name .. ': ' .. text) end return end for _,v in ipairs(settings['adminTag']['ACL']) do if isObjectInACLGroup('user.' .. account, aclGetGroup(v[1])) and check == 0 and not spam[serial] then local message = v[2] .. RGBToHex(r, g, b) .. name .. ":#FFFFFF " .. text if 128 <= #message then outputChatBox('#FF0000Error: The message you entered is too big, please lower it!', source, 255, 255, 255, true) check = 1 else check = 1 outputChatBox(message, getRootElement(), 255, 255, 255, true) if settings['antiSpamFilter']['enabled'] then aclgroup = split(settings['antiSpamFilter']['execeptionGroups'], ', ') or settings['antiSpamFilter']['execeptionGroups'] for i, v in ipairs(aclgroup) do if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup(v)) then spamCheck = true end end if not spamCheck then spam[serial] = true check = 1 setTimer(function() spam[serial] = false end, settings['antiSpamFilter']['chatTimeOut']*1000, 1) end end outputServerLog('CHAT: '.. v[2] .. name .. ': ' .. text) end elseif spam[serial] and check == 0 then outputChatBox('#FF0000Error: Please wait '..settings['antiSpamFilter']['chatTimeOut']..' seconds before saying a message!', source, 255, 255, 255, true) check = 1 end end elseif msgtype == 1 and not settings['enableTeamChat'] then cancelEvent() end end addEventHandler("onPlayerChat", getRootElement(), chatbox) addEventHandler("onPlayerQuit", getRootElement(), function() local serial = getPlayerName(source) spam[serial] = false end ) Link to comment
-.Paradox.- Posted August 5, 2013 Share Posted August 5, 2013 (edited) replace this ['حيآكم'] = 'سبحان الله', ['gay' = ['insult not allowed.' with ['حيآكم'] = ['سبحان الله'], ['gay'] = ['insult not allowed.'] Edited August 5, 2013 by Guest Link to comment
iPrestege Posted August 5, 2013 Share Posted August 5, 2013 g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_PlayerData = {} g_VehicleData = {} local chatTime = {} local lastChatMessage = {} g_ArmedVehicles = { [425] = true, [447] = true, [520] = true, [430] = true, [464] = true, [432] = true } g_Trailers = { [606] = true, [607] = true, [610] = true, [590] = true, [569] = true, [611] = true, [584] = true, [608] = true, [435] = true, [450] = true, [591] = true } g_RPCFunctions = { addPedClothes = { option = 'clothes', descr = 'Modifying clothes' }, addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, fadeVehiclePassengersCamera = true, fixVehicle = { option = 'repair', descr = 'Repairing vehicles' }, giveMeVehicles = { option = 'createvehicle', descr = 'Creating vehicles' }, giveMeWeapon = { option = 'weapons.enabled', descr = 'Getting weapons' }, givePedJetPack = { option = 'jetpack', descr = 'Getting a jetpack' }, killPed = { option = 'kill', descr = 'Killing yourself' }, removePedClothes = { option = 'clothes', descr = 'Modifying clothes' }, removePedFromVehicle = true, removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' }, removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' }, setElementPosition = true, setElementInterior = true, setMyGameSpeed = { option = 'gamespeed.enabled', descr = 'Setting game speed' }, setMySkin = { option = 'setskin', descr = 'Setting skin' }, setPedAnimation = { option = 'anim', descr = 'Setting an animation' }, setPedFightingStyle = { option = 'setstyle', descr = 'Setting fighting style' }, setPedGravity = { option = 'gravity.enabled', descr = 'Setting gravity' }, setPedStat = { option = 'stats', descr = 'Changing stats' }, setTime = { option = 'time.set', descr = 'Changing time' }, setTimeFrozen = { option = 'time.freeze', descr = 'Freezing time' }, setVehicleColor = true, setVehicleHeadLightColor = true, setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' }, setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' }, setVehicleRotation = true, setWeather = { option = 'weather', descr = 'Setting weather' }, spawnMe = true, warpMe = { option = 'warp', descr = 'Warping' } } g_OptionDefaults = { alpha = true, anim = true, clothes = true, createvehicle = true, gamespeed = { enabled = true, min = 0.0, max = 3 }, gravity = { enabled = true, min = 0, max = 0.1 }, jetpack = true, kill = true, lights = true, paintjob = true, repair = true, setskin = true, setstyle = true, spawnmaponstart = true, spawnmapondeath = true, stats = true, time = { set = true, freeze = true }, upgrades = true, warp = true, weapons = { enabled = true, vehiclesenabled = true, disallowed = {} }, weather = true, welcometextonstart = true, vehicles = { maxidletime = 60000, idleexplode = true, maxperplayer = 2, disallowed = {} } } function getOption(optionName) local option = get(optionName:gsub('%.', '/')) if option then if option == 'true' then option = true elseif option == 'false' then option = false end return option end option = g_OptionDefaults for i,part in ipairs(optionName:split('.')) do option = option[part] end return option end addEventHandler('onResourceStart', g_ResRoot, function() table.each(getElementsByType('player'), joinHandler) end ) function joinHandler(player) if not player then player = source end local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255) setPlayerNametagColor(player, r, g, b) g_PlayerData[player] = { vehicles = {} } g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b) if g_FrozenTime then clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather) end if getOption('welcometextonstart') then outputChatBox('Welcome to Freeroam', player, 0, 255, 0) outputChatBox('Press F1 to show/hide controls', player, 0, 255, 0) end end addEventHandler('onPlayerJoin', g_Root, joinHandler) addEvent('onLoadedAtClient', true) addEventHandler('onLoadedAtClient', g_ResRoot, function(player) if getOption('spawnmaponstart') and isPedDead(player) then clientCall(player, 'showWelcomeMap') end end, false ) addEventHandler('onPlayerWasted', g_Root, function() if not getOption('spawnmapondeath') then return end local player = source setTimer( function() if isPedDead(player) then clientCall(player, 'showMap') end end, 2000, 1 ) end ) addEvent('onClothesInit', true) addEventHandler('onClothesInit', g_Root, function() local result = {} local texture, model -- get all clothes result.allClothes = {} local typeGroup, index for type=0,17 do typeGroup = {'group', type = type, name = getClothesTypeName(type), children = {}} table.insert(result.allClothes, typeGroup) index = 0 texture, model = getClothesByTypeIndex(type, index) while texture do table.insert(typeGroup.children, {id = index, texture = texture, model = model}) index = index + 1 texture, model = getClothesByTypeIndex(type, index) end end -- get current player clothes { type = {texture=texture, model=model} } result.playerClothes = {} for type=0,17 do texture, model = getPedClothes(source, type) if texture then result.playerClothes[type] = {texture = texture, model = model} end end triggerClientEvent(source, 'onClientClothesInit', source, result) end ) addEvent('onPlayerGravInit', true) addEventHandler('onPlayerGravInit', g_Root, function() triggerClientEvent('onClientPlayerGravInit', source, getPedGravity(source)) end ) function setMySkin(skinid) if isPedDead(source) then local x, y, z = getElementPosition(source) if isPedTerminated(source) then x = 0 y = 0 z = 3 end local r = getPedRotation(source) local interior = getElementInterior(source) spawnPlayer(source, x, y, z, r, skinid) setElementInterior(source, interior) setCameraInterior(source, interior) else setElementModel(source, skinid) setElementHealth(source, 100) end setCameraTarget(source, source) setCameraInterior(source, getElementInterior(source)) end function spawnMe(x, y, z) if not x then x, y, z = getElementPosition(source) end if isPedTerminated(source) then repeat until spawnPlayer(source, x, y, z, 0, math.random(9, 288)) else spawnPlayer(source, x, y, z, 0, getPedSkin(source)) end setCameraTarget(source, source) setCameraInterior(source, getElementInterior(source)) end function warpMe(targetPlayer) Link to comment
isa_Khamdan Posted August 5, 2013 Author Share Posted August 5, 2013 g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_PlayerData = {} g_VehicleData = {} local chatTime = {} local lastChatMessage = {} g_ArmedVehicles = { [425] = true, [447] = true, [520] = true, [430] = true, [464] = true, [432] = true } g_Trailers = { [606] = true, [607] = true, [610] = true, [590] = true, [569] = true, [611] = true, [584] = true, [608] = true, [435] = true, [450] = true, [591] = true } g_RPCFunctions = { addPedClothes = { option = 'clothes', descr = 'Modifying clothes' }, addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, fadeVehiclePassengersCamera = true, fixVehicle = { option = 'repair', descr = 'Repairing vehicles' }, giveMeVehicles = { option = 'createvehicle', descr = 'Creating vehicles' }, giveMeWeapon = { option = 'weapons.enabled', descr = 'Getting weapons' }, givePedJetPack = { option = 'jetpack', descr = 'Getting a jetpack' }, killPed = { option = 'kill', descr = 'Killing yourself' }, removePedClothes = { option = 'clothes', descr = 'Modifying clothes' }, removePedFromVehicle = true, removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' }, removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' }, setElementPosition = true, setElementInterior = true, setMyGameSpeed = { option = 'gamespeed.enabled', descr = 'Setting game speed' }, setMySkin = { option = 'setskin', descr = 'Setting skin' }, setPedAnimation = { option = 'anim', descr = 'Setting an animation' }, setPedFightingStyle = { option = 'setstyle', descr = 'Setting fighting style' }, setPedGravity = { option = 'gravity.enabled', descr = 'Setting gravity' }, setPedStat = { option = 'stats', descr = 'Changing stats' }, setTime = { option = 'time.set', descr = 'Changing time' }, setTimeFrozen = { option = 'time.freeze', descr = 'Freezing time' }, setVehicleColor = true, setVehicleHeadLightColor = true, setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' }, setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' }, setVehicleRotation = true, setWeather = { option = 'weather', descr = 'Setting weather' }, spawnMe = true, warpMe = { option = 'warp', descr = 'Warping' } } g_OptionDefaults = { alpha = true, anim = true, clothes = true, createvehicle = true, gamespeed = { enabled = true, min = 0.0, max = 3 }, gravity = { enabled = true, min = 0, max = 0.1 }, jetpack = true, kill = true, lights = true, paintjob = true, repair = true, setskin = true, setstyle = true, spawnmaponstart = true, spawnmapondeath = true, stats = true, time = { set = true, freeze = true }, upgrades = true, warp = true, weapons = { enabled = true, vehiclesenabled = true, disallowed = {} }, weather = true, welcometextonstart = true, vehicles = { maxidletime = 60000, idleexplode = true, maxperplayer = 2, disallowed = {} } } function getOption(optionName) local option = get(optionName:gsub('%.', '/')) if option then if option == 'true' then option = true elseif option == 'false' then option = false end return option end option = g_OptionDefaults for i,part in ipairs(optionName:split('.')) do option = option[part] end return option end addEventHandler('onResourceStart', g_ResRoot, function() table.each(getElementsByType('player'), joinHandler) end ) function joinHandler(player) if not player then player = source end local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255) setPlayerNametagColor(player, r, g, b) g_PlayerData[player] = { vehicles = {} } g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b) if g_FrozenTime then clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather) end if getOption('welcometextonstart') then outputChatBox('Welcome to Freeroam', player, 0, 255, 0) outputChatBox('Press F1 to show/hide controls', player, 0, 255, 0) end end addEventHandler('onPlayerJoin', g_Root, joinHandler) addEvent('onLoadedAtClient', true) addEventHandler('onLoadedAtClient', g_ResRoot, function(player) if getOption('spawnmaponstart') and isPedDead(player) then clientCall(player, 'showWelcomeMap') end end, false ) addEventHandler('onPlayerWasted', g_Root, function() if not getOption('spawnmapondeath') then return end local player = source setTimer( function() if isPedDead(player) then clientCall(player, 'showMap') end end, 2000, 1 ) end ) addEvent('onClothesInit', true) addEventHandler('onClothesInit', g_Root, function() local result = {} local texture, model -- get all clothes result.allClothes = {} local typeGroup, index for type=0,17 do typeGroup = {'group', type = type, name = getClothesTypeName(type), children = {}} table.insert(result.allClothes, typeGroup) index = 0 texture, model = getClothesByTypeIndex(type, index) while texture do table.insert(typeGroup.children, {id = index, texture = texture, model = model}) index = index + 1 texture, model = getClothesByTypeIndex(type, index) end end -- get current player clothes { type = {texture=texture, model=model} } result.playerClothes = {} for type=0,17 do texture, model = getPedClothes(source, type) if texture then result.playerClothes[type] = {texture = texture, model = model} end end triggerClientEvent(source, 'onClientClothesInit', source, result) end ) addEvent('onPlayerGravInit', true) addEventHandler('onPlayerGravInit', g_Root, function() triggerClientEvent('onClientPlayerGravInit', source, getPedGravity(source)) end ) function setMySkin(skinid) if isPedDead(source) then local x, y, z = getElementPosition(source) if isPedTerminated(source) then x = 0 y = 0 z = 3 end local r = getPedRotation(source) local interior = getElementInterior(source) spawnPlayer(source, x, y, z, r, skinid) setElementInterior(source, interior) setCameraInterior(source, interior) else setElementModel(source, skinid) setElementHealth(source, 100) end setCameraTarget(source, source) setCameraInterior(source, getElementInterior(source)) end function spawnMe(x, y, z) if not x then x, y, z = getElementPosition(source) end if isPedTerminated(source) then repeat until spawnPlayer(source, x, y, z, 0, math.random(9, 288)) else spawnPlayer(source, x, y, z, 0, getPedSkin(source)) end setCameraTarget(source, source) setCameraInterior(source, getElementInterior(source)) end Link to comment
isa_Khamdan Posted August 5, 2013 Author Share Posted August 5, 2013 Here is the Tag system I am using --Client Side --][ -- ** Scripted By MR.S3D --][ local Key = "0" local render = false Tag = {} word = {} CurrentLange = {"English"} Col = { {255,0,0}, {0,0,255}, } Color1 = {} Color2 = {} local Rroot = getResourceRootElement(getThisResource()) local warning = { ["English"] = {[0] = "error", [1] = "warning", [2] = "question", [3] = "info",[4] = "Yes",[5] = "No",[6] ="ok"}, ["Arabic|العربية"] = {[0] = "خطأ", [1] = "تحذير", [2] = "سؤال", [3] = "معلومات",[4] = "نعم",[5] = "لا",[6] = "تم"} } local screenW, screenH = guiGetScreenSize() function CallServer(funcname, ...) local arg = { ... } triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg)) end function callClientFunction(funcname, ...) local arg = { ... } loadstring("return TagWindow."..funcname)()(unpack(arg)) end addEvent("onServerCallsClientFunction", true) addEventHandler("onServerCallsClientFunction", resourceRoot, callClientFunction) TagWindow = { sendAccept = function ( arg ) if guiGetVisible ( errorgWnd ) then TagWindow.guiDestroyerror() end unbindKey ( "enter", "down", sendInput ) if arg == false then return end if type ( arg ) == "table" and #arg > 0 then local tab = table.remove ( arg, 1 ) if type ( tab ) == "function" then tab ( unpack ( arg ) ) end end end, errorWindow = function ( text, error, arg) if type(error) ~= "number" or type(text) ~= "string" then return false end if isElement ( errorWnd ) then TagWindow.guiDestroyerror ( ) end if guiGetVisible ( S3Dwindow.window[1] ) then guiSetEnabled ( S3Dwindow.window[1], false ) end errorgWnd = guiCreateWindow ( (screenW/2)-200, (screenH/2)-67, 400, 134, warning[CurrentLange[1]][error], false ) local label = guiCreateLabel ( 114, 30, 276, 70, text, false, errorgWnd ) guiLabelSetHorizontalAlign ( label, "left", true ) guiSetFont ( label, "default-small" ) if error == 3 then Yes = guiCreateButton ( 80, 100, 277, 25, warning[CurrentLange[1]][6], false, errorgWnd ) else Yes = guiCreateButton ( 30, 100, 136, 25, warning[CurrentLange[1]][4], false, errorgWnd ) No = guiCreateButton ( 250, 100, 136, 25, warning[CurrentLange[1]][5], false, errorgWnd ) end bindKey ( "enter", "down", TagWindow.sendAccept, arg ) addEventHandler ( "onClientGUIClick", Yes, function ( ) TagWindow.sendAccept (arg) end, false ) if isElement(No) then addEventHandler ( "onClientGUIClick", No, function ( )TagWindow.sendAccept( false ) end, false ) end guiBringToFront ( errorgWnd ) showCursor ( true, true ) end, guiDestroyerror = function ( ) showCursor ( false, false ) if isElement ( errorgWnd ) then guiSetEnabled ( S3Dwindow.window[1], true ) destroyElement ( errorgWnd ) end if guiGetVisible ( S3Dwindow.window[1] ) then guiBringToFront ( S3Dwindow.window[1] ) showCursor ( true, true ) end return true end, errorMsg = { ["Arabic|العربية"] = { "يجب أن يكون التاج 4 حروف أو أكثر", "يجب أن تكون الكلمة من حرفين أو أكثر", "هل أنت متأكد من حذف هذا التاج ؟", "تم حذف التاج", "تم اضافة تاج جديد", "لم يتم اختيار لون الرسالة أو لون التاج", "هل أنت متأكد من تعديل هذا التاج ؟", "تأكد من البيانات المدخلة", "لم يتم إختيار أي قروب", "هل أنت متأكد من اضافة تاج جديد ؟", "تم اضافة الكلمة", "هل أنت متأكد من حذف هذه الكلمة ؟", "تم حذف الكلمة", }, ["English"] = { "The Tag name must be 4 characters or more", "The word must be 2 characters or more", "Are you sure you want delete this tag?", "Tag was deleted", "New Tag was added", "Not choose the color of the Tag or color message", "Are you sure you want modify this tag?", "Make sure all data entered", "No Acl selected", "Are you sure you want add new tag?", "Word was added", "Are you sure you want delete this word?", "Word was deleted", } }, error = function(i,level, ...) local arg = { ... } TagWindow.errorWindow(TagWindow.errorMsg[CurrentLange[1]][i],level,arg) end, default = { x = 67, y = 117, width = 633, height = 303, }, onCreat = function() Language = { ["Arabic|العربية"] = { [S3Dwindow.window[1]] = ":: لوحة صنع التاجات ::", [S3Dwindow.label[1]] = "اسم القروب :", [S3Dwindow.label[2]] = "التاج :", [S3Dwindow.label[3]] = "اضافة كلمة :", [S3Dwindow.label[4]] = "التحكم بـ اللون :", [S3Dwindow.label[5]] = "اللغة :", [S3Dwindow.checkbox[1]] = "لون الرسالة", [S3Dwindow.checkbox[2]] = "لون التاج", [S3Dwindow.button[1]] = "اضافة كلمة", [S3Dwindow.button[2]] = "حذف الكلمة", [S3Dwindow.button[3]] = "حذف التاج", [S3Dwindow.button[4]] = "اضافة تاج", }, ["English"] = { [S3Dwindow.window[1]] = ":: Set Groups Tag ::", [S3Dwindow.label[1]] = "ACL :", [S3Dwindow.label[2]] = "Tag :", [S3Dwindow.label[3]] = "Add word :", [S3Dwindow.label[4]] = "Control color:", [S3Dwindow.label[5]] = "Langauge:", [S3Dwindow.checkbox[1]] = "Color message", [S3Dwindow.checkbox[2]] = "Color tag", [S3Dwindow.button[1]] = "Add Word", [S3Dwindow.button[2]] = "Remove Word", [S3Dwindow.button[3]] = "Remove Tag", [S3Dwindow.button[4]] = "Add Tag", }, } local lang = TagWindow.getAllLanguage( "English" ) for k, v in pairs ( lang ) do guiSetText( v.element, v.id) end end, isFoundInLangage = function ( val ) if Language[ val ] then return true; end return false; end, getAllLanguage = function ( val ) local lang = {} if TagWindow.isFoundInLangage( val ) then for k, v in pairs ( Language[ val ] ) do if not isElement(k) then outputDebugString ( "Error" ) return {}; end table.insert(lang, {element = k,id = v}); end; end return lang; end, setgrid = function( gridlist, row, col, text, r, g, b) guiGridListSetItemText( gridlist, row, col, text, false, false ) guiGridListSetItemData( gridlist, row, col, tostring(text)) if tonumber(r) and tonumber(g) and tonumber(b) then guiGridListSetItemColor ( gridlist, row, col, r, g, b ) end end, getgrid = function ( gridlist, row, col ) return tostring ( guiGridListGetItemText( gridlist, row, col ) ) end, RGBToHex = function(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("%.2X%.2X%.2X%.2X", alpha, red, green,blue) else return string.format("%.2X%.2X%.2X", red,green,blue) end end, hex2rgb = function(hex) hex = hex:gsub("#","") return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)) end, MainWindow = function() S3Dwindow = { memo = {}, button = {}, edit = {}, window = {}, gridlist = {}, checkbox = {}, label = {}, combobox = {}, } lnagTextCombobox = {"Arabic|العربية","English"} griditem = {"Tag Name |اسم التاج","blocked words|الكلمات الممنوعة"} local x,y = (screenW-TagWindow.default.width)/2,(screenH-TagWindow.default.height)/2 S3Dwindow.window[1] = guiCreateWindow(x,y, TagWindow.default.width, TagWindow.default.height, "", false) guiSetVisible(S3Dwindow.window[1], false) guiWindowSetSizable(S3Dwindow.window[1], false) guiSetAlpha(S3Dwindow.window[1], 1.00) S3Dwindow.gridlist[1] = guiCreateGridList(9, 23, 127, 273, false, S3Dwindow.window[1]) guiGridListAddColumn(S3Dwindow.gridlist[1],griditem[1], 0.90) S3Dwindow.label[1] = guiCreateLabel(154, 25, 174, 24, "", false, S3Dwindow.window[1]) S3Dwindow.label[2] = guiCreateLabel(153, 91, 187, 22, "", false, S3Dwindow.window[1]) S3Dwindow.edit[1] = guiCreateEdit(151, 124, 178, 23, "", false, S3Dwindow.window[1]) S3Dwindow.checkbox[1] = guiCreateCheckBox(152, 263, 123, 18, "", false, false, S3Dwindow.window[1]) S3Dwindow.gridlist[2] = guiCreateGridList(391, 26, 113, 175, false, S3Dwindow.window[1]) guiGridListAddColumn(S3Dwindow.gridlist[2], griditem[2], 1.39) S3Dwindow.label[3] = guiCreateLabel(523, 26, 133, 21, "", false, S3Dwindow.window[1]) S3Dwindow.edit[2] = guiCreateEdit(514, 62, 109, 19, "", false, S3Dwindow.window[1]) S3Dwindow.button[1] = guiCreateButton(519, 97, 104, 22, "", false, S3Dwindow.window[1]) S3Dwindow.label[4] = guiCreateLabel(186, 213, 128, 21, "", false, S3Dwindow.window[1]) S3Dwindow.combobox[1] = guiCreateComboBox(153, 56, 180, 100, "", false, S3Dwindow.window[1]) S3Dwindow.memo[1] = guiCreateMemo(354, 23, 20, 273, "", false, S3Dwindow.window[1]) guiMemoSetReadOnly(S3Dwindow.memo[1], true) S3Dwindow.button[2] = guiCreateButton(522, 132, 102, 22, "", false, S3Dwindow.window[1]) S3Dwindow.checkbox[2] = guiCreateCheckBox(152, 238, 123, 18, "", false, false, S3Dwindow.window[1]) S3Dwindow.button[3] = guiCreateButton(247, 164, 97, 24, "", false, S3Dwindow.window[1]) S3Dwindow.button[4] = guiCreateButton(141, 164, 97, 24, "", false, S3Dwindow.window[1]) S3Dwindow.label[5] = guiCreateLabel(450, 203, 237, 15, "", false, S3Dwindow.window[1]) S3Dwindow.combobox[2] = guiCreateComboBox(400, 225, 180, 80, "", false, S3Dwindow.window[1]) for i = 1, #lnagTextCombobox do 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