Jump to content

Need help,


Alen141

Recommended Posts

Posted

hey guys I wanted to know how to set a new data name in the .map file called "team" and then using script check for team, if not in team he gets some message!

Posted
This would require alot of scripting (to add the argument) it could be done, but it would just be faster to make a scripted car.

I know that, but I know to do it only this way

car1 = createvehicle (...) 
car2 = createvehicle (...) 
if ( source == car1 or source == car2 ) then ----CHECK IF TEAM and so on 

can u tell me how to make idk, maybe like table and then

if source == tablename 

Posted

To script it youll need this:

car = createVehicle ( id, x, y, z ) 
addEventHandler ( "onVehicleStartEnter", car, function ( p ) 
    if ( getTeamName ( getPlayerTeam ( p ) ) ~= "The Team Name" ) then 
        cancelEvent ( ) 
    end 
end ) 

Posted
To script it youll need this:
car = createVehicle ( id, x, y, z ) 
addEventHandler ( "onVehicleStartEnter", car, function ( p ) 
    if ( getTeamName ( getPlayerTeam ( p ) ) ~= "The Team Name" ) then 
        cancelEvent ( ) 
    end 
end ) 

will this be ok too?

  
robber1 = createVehicle ( 413, 755.619140625,1980.3388671875,5.3359375,   0,0,84.406494140625 ) 
robber2 = createVehicle ( 413, 756.6923828125,1985.634765625,5.3359375,   0,0,88.817565917969 ) 
  
function lockRob ( player, seat, jacked ) 
    if ( source == robber1 or source == robber2 ) then 
        local team = getPlayerTeam ( player ) 
        local teamName = ( team and getTeamName ( team ) or "" ) 
        if ( teamName ~= "Robber" ) then 
            cancelEvent ( ) 
            outputChatBox ( "Only Robbers are allowed to use this vehicle!", player, 255, 0, 0, true ) 
        end 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), lockRob ) 
  
  

Posted
Yes, that'll work.

It does :D, If you are reading this can you tell me what's best way to learn lua/mta scripting AND MOST of all GUIs

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