Dziugasc Posted December 29, 2017 Share Posted December 29, 2017 (edited) So i have this code and i tried to make gang creation system GUI is 50% done and does not create teams on TAB [Scoreboard] i tried making that it would create it on tab but nothing would happen also i don't know how to make gang tag and skin gang tag would look like this [GANG] in beginning means that this team is GANG not something else [GANG] Grove Street [GS]Dziugasc i don't want to change player name with tag just attach it on beginning of name Spoiler function OpenStatusWindow() guiSetVisible(GUIEditor.window[1],true) showCursor(true,true) end addCommandHandler("gang",OpenStatusWindow) GUIEditor = { button = {}, window = {}, edit = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.37, 0.28, 0.28, 0.42, "MINI-GANG Kurimo panele", true) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.90) guiSetProperty(GUIEditor.window[1], "TitlebarEnabled", "True") guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFFFFEFE") GUIEditor.label[1] = guiCreateLabel(0.05, 0.12, 0.35, 0.05, "1. Gang Name:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[1], "left", true) GUIEditor.edit[1] = guiCreateEdit(0.40, 0.11, 0.52, 0.07, "", true, GUIEditor.window[1]) guiEditSetMaxLength(GUIEditor.edit[1], 20) GUIEditor.label[2] = guiCreateLabel(0.05, 0.24, 0.24, 0.06, "2. Gang TAG:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[2], "left", true) GUIEditor.label[3] = guiCreateLabel(0.39, 0.24, 0.04, 0.06, "[", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[3], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", true) GUIEditor.label[4] = guiCreateLabel(0.83, 0.24, 0.04, 0.06, "]", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[4], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", true) GUIEditor.edit[2] = guiCreateEdit(0.46, 0.22, 0.34, 0.09, "", true, GUIEditor.window[1]) guiEditSetMaxLength(GUIEditor.edit[2], 10) GUIEditor.label[5] = guiCreateLabel(0.05, 0.35, 0.28, 0.05, "3. Gang Color:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[5], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[5], "left", true) GUIEditor.label[6] = guiCreateLabel(0.36, 0.34, 0.05, 0.07, "R:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[6], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[6], "center", true) guiLabelSetVerticalAlign(GUIEditor.label[6], "center") GUIEditor.edit[3] = guiCreateEdit(0.40, 0.34, 0.14, 0.07, "", true, GUIEditor.window[1]) guiEditSetMaxLength(GUIEditor.edit[3], 3) GUIEditor.label[7] = guiCreateLabel(0.55, 0.34, 0.05, 0.07, "G:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[7], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[7], "center", true) guiLabelSetVerticalAlign(GUIEditor.label[7], "center") GUIEditor.edit[4] = guiCreateEdit(0.59, 0.34, 0.14, 0.07, "", true, GUIEditor.window[1]) guiEditSetMaxLength(GUIEditor.edit[4], 3) GUIEditor.label[8] = guiCreateLabel(0.74, 0.34, 0.05, 0.07, "B:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[8], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[8], "center", true) guiLabelSetVerticalAlign(GUIEditor.label[8], "center") GUIEditor.edit[5] = guiCreateEdit(0.79, 0.34, 0.14, 0.07, "", true, GUIEditor.window[1]) guiEditSetMaxLength(GUIEditor.edit[5], 3) GUIEditor.edit[6] = guiCreateEdit(0.40, 0.46, 0.14, 0.07, "", true, GUIEditor.window[1]) guiEditSetMaxLength(GUIEditor.edit[6], 3) GUIEditor.label[9] = guiCreateLabel(0.05, 0.47, 0.26, 0.05, "4. Gang skin:", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[9], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[9], "left", true) GUIEditor.label[10] = guiCreateLabel(0.05, 0.62, 0.51, 0.05, "Gang price 20M = 20 000 000 $", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[10], "default-bold-small") GUIEditor.label[11] = guiCreateLabel(0.05, 0.71, 0.92, 0.05, "Gang colors have to be unique", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[11], "default-bold-small") GUIEditor.label[12] = guiCreateLabel(0.05, 0.67, 0.61, 0.05, "Rules are equal for everyone", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[12], "default-bold-small") GUIEditor.label[13] = guiCreateLabel(0.05, 0.76, 0.61, 0.05, "Looking for RGB? www.colorpicker.com", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[13], "default-bold-small") GUIEditor.label[14] = guiCreateLabel(0.05, 0.81, 0.84, 0.05, "Looking for Skins? http://wiki.sa-mp.com/wiki/Skins:All", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[14], "default-bold-small") GUIEditor.button[1] = guiCreateButton(0.91, 0.91, 0.06, 0.06, "X", true, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(16, 293, 58, 19, "Create!", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.label[15] = guiCreateLabel(88, 275, 106, 43, "Black", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[15], "sa-header") guiLabelSetColor(GUIEditor.label[15], 0, 0, 0) GUIEditor.label[16] = guiCreateLabel(0.56, 0.85, 0.30, 0.13, "Room", true, GUIEditor.window[1]) guiSetFont(GUIEditor.label[16], "sa-header") guiLabelSetColor(GUIEditor.label[16], 254, 254, 254) guiSetVisible(GUIEditor.window[1],false) addEventHandler ( "onClientGUIClick", GUIEditor.button[1], function ( ) if (source == GUIEditor.button[1]) then guiSetVisible (GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) showCursor(false, false) end end ) addEventHandler( "onClientGUIClick", root, function( b, s ) if (source == GUIEditor.button[2]) then local teamN, r, g, b, teamT, teamS = guiGetText( GUIEditor.edit[1] ), guiGetText( GUIEditor.edit[3] ), guiGetText( GUIEditor.edit[4] ), guiGetText( GUIEditor.edit[5] ), guiGetText( GUIEditor.edit[2] ), guiGetText( GUIEditor.edit[6] ) if (teamN == "") then return outputChatBox( "#808080[INFO] #FF0000Gang name cannot be empty!", 255, 120, 0, true) end if (getTeamFromName( teamN )) then return outputChatBox( "#808080[INFO] #FF0000A Gang ("..teamN..") with this name already exist!", 255, 120, 0, true) end if (teamT == "") then return outputChatBox( "#808080[INFO] #FF0000TAG cannot be empty!", 255, 120, 0, true) end if (r == "") then return outputChatBox( "#808080[INFO] #FF0000R (Red) cannot be empty!", 255, 120, 0, true) end if (g == "") then return outputChatBox( "#808080[INFO] #FF0000G (Green) cannot be empty!", 255, 120, 0, true) end if (b == "") then return outputChatBox( "#808080[INFO] #FF0000B (Blue) cannot be empty!", 255, 120, 0, true) end if (teamS == "") then return outputChatBox( "#808080[INFO] #FF0000Skin cannot be empty!", 255, 120, 0, true) end outputChatBox( "#808080[INFO] #00FF00Gang "..teamN.." created!", 255, 120, 0, true) triggerServerEvent( "GUI:createTeam", localPlayer, teamN, r, g, b, teamT, teamS, ( GUIEditor.button[2] ) ) end end ) end ) Here is server side what i tried Spoiler function createTeamEvent( teamN, r, g, b ) createTeam ( teamN, r or 255, g or 255, b or 255 ); setPlayerTeam ( localPlayer, getTeamFromName ( teamN ) ); end addEvent( "GUI:createTeam", true ) addEventHandler( "GUI:createTeam", root, createTeamEvent ) Edited December 29, 2017 by Dziugasc Link to comment
DRW Posted December 29, 2017 Share Posted December 29, 2017 (edited) About your problem related to the teams. You're setting the team of the localPlayer. The localPlayer variable only works clientside, try this: function createTeamEvent( uArg1, r, g, b ) local team = createTeam ( uArg1, r or 255, g or 255, b or 255 ); setPlayerTeam ( source, team) ); end addEvent( "GUI:createTeam", true ) addEventHandler( "GUI:createTeam", root, createTeamEvent ) About the gang tag. If you don't want to change the player's name but show his tag you can always use: addEventHandler ("onPlayerChat",root,function(text,messagetype) if messagetype == 0 then if getPlayerTeam (source) then outputChatBox ("["..getTeamName (getPlayerTeam(source)).."] "..getPlayerName (source))..": "..text,root) cancelEvent () end end end) This will replace the default chat messages. You can also set setPlayerNametagText and get creative. Next time please check the debugscript so you won't have to come here because of a variable name. Edited December 29, 2017 by MadnessReloaded 1 Link to comment
Dziugasc Posted December 29, 2017 Author Share Posted December 29, 2017 21 minutes ago, MadnessReloaded said: About your problem related to the teams. You're setting the team of the localPlayer. The localPlayer variable only works clientside, try this: function createTeamEvent( uArg1, r, g, b ) local team = createTeam ( uArg1, r or 255, g or 255, b or 255 ); setPlayerTeam ( source, team) ); end addEvent( "GUI:createTeam", true ) addEventHandler( "GUI:createTeam", root, createTeamEvent ) About the gang tag. If you don't want to change the player's name but show his tag you can always use: addEventHandler ("onPlayerChat",root,function(text,messagetype) if messagetype == 0 then if getPlayerTeam (source) then outputChatBox ("["..getTeamName (getPlayerTeam(source)).."] "..getPlayerName (source))..": "..text,root) cancelEvent () end end end) This will replace the default chat messages. You can also set setPlayerNametagText and get creative. Next time please check the debugscript so you won't have to come here because of a variable name. well i did that but still it does not create gang debug doesn't say anything Link to comment
mazarati21 Posted December 29, 2017 Share Posted December 29, 2017 (edited) In the line 202 change to this: triggerServerEvent( "GUI:createTeam", localPlayer, teamN, r, g, b, teamT, teamS) Edited December 29, 2017 by mazarati21 1 Link to comment
Dziugasc Posted December 29, 2017 Author Share Posted December 29, 2017 8 minutes ago, mazarati21 said: In the line 202 change to this: triggerServerEvent( "GUI:createTeam", localPlayer, teamN, r, g, b, teamT, teamS) Success because of you guys i'm really happy Link to comment
Dziugasc Posted December 31, 2017 Author Share Posted December 31, 2017 So i got this turf system edited little bit but it doesn't remove turfing when player leaves turf Spoiler function nobodyInTurf(group, turfElement) if (group and turfElement) then for index, ent in pairs(getElementsByType("player")) do local g2 = getPlayerTeam(ent) if (isElementWithinColShape(ent, turfElement) and g2 == group) then isSomebodyInTurf[group] = true elseif (not isElementWithinColShape(ent, turfElement) and g2 == group) then isSomebodyInTurf[group] = false end end if (not isSomebodyInTurf[group]) then if (capture[group] and isTimer(capture[group])) then killTimer(capture[group]) if (isTimer(timer[group])) then killTimer(timer[group]) end for index, ent in pairs(getElementsByType("player")) do local g2 = getPlayerTeam(ent) if (g2 and g2 == group) then capture[group] = false timer[group] = false setRadarAreaFlashing(radar[turfElement], false) triggerClientEvent(ent, "CSFturfs.removeDrawing", ent) outputChatBox("Your group has failed to take the turf "..turfName[turfElement], ent, 255, 0, 0) end end end end end end Link to comment
mazarati21 Posted December 31, 2017 Share Posted December 31, 2017 Show your client side code. 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