Jump to content

Problem script


xeon17

Recommended Posts

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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...