Jump to content

help with teamcars


jirco

Recommended Posts

Posted

Hello everybody,

i wanted to ask something i just started scripting and i made a script that other teams can't enter but i want that a gui box opens and that the text is in it instead of the outputchatbox but i just don't know how can anybody help me please? and i wanted to ask if this script is correct i didn't tested it yet

    teamName = "CIA" or "SFPD" or "Military Police" or "U.S. Army" 
        SFPDVehs = { [427] = true } 
    SFPDVehs = { [523] = true } 
    SFPDVehs = { [525] = true } 
    SFPDVehs = { [596] = true } 
    SFPDVehs = { [599] = true } 
    SFPDVehs = { [597] = true } 
    SFPDVehs = { [598] = true } 
    SFPDVehs = { [497] = true } 
      
    function enterVehicle ( thePlayer ) 
        if SFPDVehs [ getElementModel ( source ) ] then 
            if getTeamFromName ( teamName ) then 
                if getPlayerTeam ( thePlayer ) ~= getTeamFromName ( teamName ) then 
                     function exitVehicle ( thePlayer ) and outputChatBox ( "Only the fraktions can drive these cars!", thePlayer, 255, 0, 0, true ) 
                    cancelEvent ( ) 
                end 
            else 
                outputChatBox ( "The Team Is not Available !", thePlayer, 255, 255, 0, true )       
            end 
        end 
    end 
    addEventHandler ( "onVehicleStartEnter", root, enterVehicle ) 

Posted

That script itself doesn't really make much sense, it has a lot of problems.

Such as, how you define "teamName" variable, also the table with vehicle models, you're replacing it each time.

Posted
That script itself doesn't really make much sense, it has a lot of problems.

Such as, how you define "teamName" variable, also the table with vehicle models, you're replacing it each time.

SFPDVehs = { [427] = true, [523] = true, [525] = true, [596] = true, [599] = true, [597] = true, [598] = true, [497] = true} 

Should it be that Castillo, if i am not wrong? :/

Edit: Also, I am not too sure, but this may help??

viewtopic.php?f=91&t=53083

Posted
Yes, of course.

He would need to use:

triggerClientEvent 
addEvent 
addEventHandler 
guiSetVisible 

That's exactly what I mean, hope he understands that... So if he were to trigger the

onVehicleStartEnter 

, would that work?

Posted
Hello everybody,

i wanted to ask something i just started scripting and i made a script that other teams can't enter but i want that a gui box opens and that the text is in it instead of the outputchatbox but i just don't know how can anybody help me please? and i wanted to ask if this script is correct i didn't tested it yet

    teamName = "CIA" or "SFPD" or "Military Police" or "U.S. Army" 
        SFPDVehs = { [427] = true } 
    SFPDVehs = { [523] = true } 
    SFPDVehs = { [525] = true } 
    SFPDVehs = { [596] = true } 
    SFPDVehs = { [599] = true } 
    SFPDVehs = { [597] = true } 
    SFPDVehs = { [598] = true } 
    SFPDVehs = { [497] = true } 
      
    function enterVehicle ( thePlayer ) 
        if SFPDVehs [ getElementModel ( source ) ] then 
            if getTeamFromName ( teamName ) then 
                if getPlayerTeam ( thePlayer ) ~= getTeamFromName ( teamName ) then 
                     function exitVehicle ( thePlayer ) and outputChatBox ( "Only the fraktions can drive these cars!", thePlayer, 255, 0, 0, true ) 
                    cancelEvent ( ) 
                end 
            else 
                outputChatBox ( "The Team Is not Available !", thePlayer, 255, 255, 0, true )       
            end 
        end 
    end 
    addEventHandler ( "onVehicleStartEnter", root, enterVehicle ) 

Anyways, I'd be glad to help you with this!

Posted

like i said i just started so there could be mistakes and thanks for the help!

and indeed i copied the script from the link and changed it to how i wanted it i was just stuck with the Gui box :)

Posted
like i said i just started so there could be mistakes and thanks for the help!

and indeed i copied the script from the link and changed it to how i wanted it i was just stuck with the Gui box :)

Do you still need help?

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