xeon17 Posted January 17, 2014 Share Posted January 17, 2014 I have problem with my script , when some player write /ingressar he should be in gang CRIME , but that no happen here is the script : CRIME = createRadarArea ( 1264.7268066406, -767.19152832031, 200, -200, 255, 0, 0 ) createBlip(1293.5074462891, -772.97387695313, 95.95964050293,16) marker1 = createMarker(1293.5074462891, -772.97387695313, 95.95964050293,"cylinder",2,0,0,255,255) function CRIME () createTeam ( "CRIME", 255, 0, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( ), CRIME ) function Gang (source) setPlayerTeam ( source, CRIME ) outputChatBox ( "#FF0000 [CRIME] #FFF000 Bem vindo a gang #FF0000 CRIME !", source, 0, 0, 0, true ) addEventHandler ( "onPlayerSpawn", source, onSpawn ) end addCommandHandler("ingressar", CRIME) function onSpawn ( ) setElementPosition ( source, 1293.5074462891, -772.97387695313, 95.95964050293 ) end addEventHandler("onMarkerHit", marker1, function (player) outputChatBox ( "#FF0000 [CRIME] #FFF000 Para entra a gang CRIME digita #00FF00 /ingressar", player, 0, 0, 0, true) end ) function sairDaGang(source) local playerTeam = getPlayerTeam (source) if (playerTeam) then setPlayerTeam (source, nil) outputChatBox("#FF0000[CRIME]#FFF000 Você saiu da gang",source,255,255,255,true) else outputChatBox("#FF0000[CRIME]#FFF000 Você não tem gang",source,255,255,255,true) end end addCommandHandler("gangabandonar", sairDaGang) i tryed this too : but only the frist player who write /ingressar get in the gang , other players no. CRIME = createRadarArea ( 1264.7268066406, -767.19152832031, 200, -200, 255, 0, 0 ) createBlip(1293.5074462891, -772.97387695313, 95.95964050293,16) marker1 = createMarker(1293.5074462891, -772.97387695313, 95.95964050293,"cylinder",2,0,0,255,255) function CRIME ( source, commandName, CRIME ) if(isElementWithinMarker(source,marker1)) then local CRIME = createTeam ( "CRIME", 255, 0, 0 ) if CRIME then setPlayerTeam ( source, CRIME ) outputChatBox ( "#FF0000 [CRIME] #FFF000 Bem vindo a gang #FF0000 CRIME !", source, 0, 0, 0, true ) addEventHandler ( "onPlayerSpawn", source, onSpawn ) end end end addCommandHandler("ingressar", CRIME) function onSpawn ( ) setElementPosition ( source, 1293.5074462891, -772.97387695313, 95.95964050293 ) end addEventHandler("onMarkerHit", marker1, function (player) outputChatBox ( "#FF0000 [CRIME] #FFF000 Para entra a gang CRIME digita #00FF00 /ingressar", player, 0, 0, 0, true) end ) function sairDaGang(source) local playerTeam = getPlayerTeam (source) if (playerTeam) then setPlayerTeam (source, nil) outputChatBox("#FF0000[CRIME]#FFF000 Você saiu da gang",source,255,255,255,true) else outputChatBox("#FF0000[CRIME]#FFF000 Você não tem gang",source,255,255,255,true) end end addCommandHandler("gangabandonar", sairDaGang) please help Link to comment
al-Kobra Posted January 17, 2014 Share Posted January 17, 2014 add this code in CRIME function if getElementData (source, "gang") == "GroupName" then Link to comment
xeon17 Posted January 17, 2014 Author Share Posted January 17, 2014 add this code in CRIME function if getElementData (source, "gang") == "GroupName" then No work , nothing happen. With my code CRIME gang get crated but player no join crime with command /ingressar i found a bug and fixed : addCommandHandler("ingressar", CRIME) to addCommandHandler("ingressar", Gang) But again not work. I think this is wrong , becouse the gang get crated but player no join gang. function Gang (source) setPlayerTeam ( source, CRIME ) Link to comment
TAPL Posted January 17, 2014 Share Posted January 17, 2014 CRIME = createRadarArea(1264.73, -767.2, 200, -200, 255, 0, 0) createBlip(1293.5, -772.98, 95.96,16) marker = createMarker(1293.5, -772.98, 95.96,"cylinder", 2, 0, 0, 255, 255) local CRIMETeam = createTeam("CRIME", 255, 0, 0) function JoinCRIME(player) if not getPlayerTeam(player) == CRIMETeam then if isElementWithinMarker(player, marker) then setPlayerTeam(player, CRIMETeam) outputChatBox("#FF0000 [CRIME] #FFF000 Bem vindo a gang #FF0000 CRIME !", player, 0, 0, 0, true) end end end addCommandHandler("ingressar", JoinCRIME) function onSpawn() if getPlayerTeam(source) == CRIMETeam then setElementPosition(source, 1293.5, -772.98, 95.96) end end addEventHandler("onPlayerSpawn", root, onSpawn) addEventHandler("onMarkerHit", marker, function(player) if getElementType(player) == "player" then outputChatBox("#FF0000 [CRIME] #FFF000 Para entra a gang CRIME digita #00FF00 /ingressar", player, 0, 0, 0, true) end end) function sairDaGang(player) if getPlayerTeam(player) then setPlayerTeam(player, nil) outputChatBox("#FF0000[CRIME]#FFF000 Você saiu da gang", player, 255, 255, 255, true) else outputChatBox("#FF0000[CRIME]#FFF000 Você n?o tem gang", player, 255, 255, 255, true) end end addCommandHandler("gangabandonar", sairDaGang) Link to comment
xeon17 Posted January 17, 2014 Author Share Posted January 17, 2014 No work TAPL nothing in debug , maybe no work becouse the marker is very up , Link to comment
TAPL Posted January 17, 2014 Share Posted January 17, 2014 You can lower the marker height a little bit and try again and check if there any error on the /debugscript 3. Link to comment
xeon17 Posted January 17, 2014 Author Share Posted January 17, 2014 No work again i changed 3 times the size of marker , but now i get the message [CRIME] bem vindo a gang.. see the screenshot Link to comment
TAPL Posted January 17, 2014 Share Posted January 17, 2014 Change this line (7): if not getPlayerTeam(player) == CRIMETeam then To: if getPlayerTeam(player) ~= CRIMETeam then Or you also can put brackets too: if not (getPlayerTeam(player) == CRIMETeam) then Link to comment
xeon17 Posted January 17, 2014 Author Share Posted January 17, 2014 Thanks TAPL it work thank you very much 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