Jump to content

Need help for a Copmode


Hulkkiller

Recommended Posts

Posted (edited)

I need help for a copmode:

" -- Error here" is for die Errors

I have 2 Errors (saying the MTA Server Console)

-- Start of the Lua Script

  
function SetTheCops ( source, commandName ) 
    setPlayerTeam ( source, copTeam ) 
    setPedSkin ( source, 285 ) 
    setPedArmor ( source, 100 ) 
    setPlayerNametagColor ( source, 0, 0, 255 ) 
    local x, y, z = getElementPosition ( source ) 
    local angle = getPedRotation ( source ) 
    local cop_vehicle = createVehicle ( 598, x, y, z ) 
    setVehicleRotation ( cop_vehicle, 0, 0, angle ) 
    warpPedIntoVehicle ( source, cop_vehicle )   
    setVehicleSirensOn ( cop_vehicle, true ) 
end 
function SetTheGangster ( source_g, commandName ) 
  if countPlayersInTeam ( gangTeam ) == 0 then 
    thegangster = source_g 
    setPlayerTeam ( source_g, gangTeam ) 
    setPedSkin ( source_g, 107 ) 
    setPedArmor ( source_g, 100 ) 
    setPlayerNametagColor ( source_g, 255, 0, 0 ) 
    local x_g, y_g, z_g = getElementPosition ( source_g ) 
    local angle_g = getPedRotation ( source_g ) 
    local vehicle_g = createVehicle ( 445, x_g, y_g, z_g ) 
    setVehicleRotation ( vehicle_g, 0, 0, angle_g ) 
    warpPedIntoVehicle ( source_g, vehicle_g )   
    outputChatBox ( thegangster .. " is the Gangster." ) -- Error here 
    else 
    outputChatBox ( "Don't can set the Gangster", getRootElement(), 255, 255, 255, true ) 
  end 
end 
function GetTheGangster ( player_g, commandName ) 
    if countPlayersInTeam ( gangTeam ) == 1 then 
        outputChatBox ( "The Gangster is " .. thegangster .. ".", getRootElement(), 255, 255, 255, true ) -- Error here 
    else 
        outputChatBox ( "We don't have a Gangster.", getRootElement(), 255, 255, 255, true ) 
    end 
end 
function RemovePlayer ( player, commandName ) 
   setPlayerTeam ( player, nil ) 
   setPlayerNametagColor ( player, 0, 255, 0 )  
   outputChatBox ( "Set the Gang of none.", getRootElement(), 255, 255, 255, true ) 
end 
function createTeamsOnStart() 
    copTeam =   createTeam ( "Police"  , 0,   0,   255 ) 
    gangTeam =  createTeam ( "Gangster", 255, 0,   0 ) 
    setTeamColor ( copTeam, 0, 0, 255 ) 
    setTeamColor ( gangTeam, 255, 0, 0 ) 
    setTeamFriendlyFire ( copTeam, true ) 
    setTeamFriendlyFire ( gangTeam, true ) -- No Colors in the Map 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) 
addCommandHandler ("police", SetTheCops) 
addCommandHandler ("gangster", SetTheGangster) 
addCommandHandler ("gangster_get", GetTheGangster) 
addCommandHandler ("none", RemovePlayer) 
  

-- End of the Lua Script :!::?::!:

Edited by Guest

My InGame Name is: [KPT]Syping/Hulkkiller

Rafael9707s_36118_7.png

Posted

whats the point of changing the color of the team when u already creating it with color??

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
  
outputChatBox ( thegangster .. " is the Gangster." ) 
-- the gangster is player element, not string with his name.. 
outputChatBox ( getPlayerName(thegangster) .. " is the Gangster." ) 
-- 2nd problem = same problem. 
  

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

Thank for the Help. :D

---------------------

Police vs Gangster

---------------------

I need a two help with the Chatbox (all player's can read the messages)

My InGame Name is: [KPT]Syping/Hulkkiller

Rafael9707s_36118_7.png

Posted
I need a two help with the Chatbox (all player's can read the messages)

wtf?

explain what do you want to do

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
( getPlayerName(thegangster) .. " is the Gangster.", theGangster ) 

If you want to make only a player read the chatbox message, add a player element after the message (in this case, theGangster).

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