Jump to content

Error on script


Dardex

Recommended Posts

Hey , can I have a hand here?

Policeskin = createMarker (    253.7255859375 , 77.0322265625 , 1003.640625 ,"cylinder", 2, 255, 255, 0, 90) 
    setElementInterior (Policeskin, 6) 
    setElementDimension (Policeskin, 1) 
    function inDutySkin (hitPlayer,dimension) 
    outputChatBox("Type /policeskin [1-6] to wear police clothes", source) 
    addEventHandler("onMarkerHit",Policeskin,inDutySkin) 
     
        function policeSkins(thePlayer, matchingDimension,cmdName,ID) 
        policeman = getPlayerFromName(thePlayer) 
    policemanTeam = getPlayerTeam(policeman) 
    if isElementWithinMarker(thePlayer, Policeskin) then 
    if (policemanTeam == "Police") then 
    if cmdName == "policeskin" then 
    if ID == "1" then 
     setElementModel(thePlayer, 280) 
     outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) 
     elseif cmdName == "policeskin" then 
    if ID == "2" then 
     setElementModel(thePlayer, 281) 
     outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) 
     elseif cmdName == "policeskin" then 
    if ID == "3" then 
     setElementModel(thePlayer, 282) 
     outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) 
     elseif cmdName == "policeskin" then 
    if ID == "4" then 
     setElementModel(thePlayer, 283) 
     outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) 
 elseif cmdName == "policeskin" then 
    if ID == "5" then 
     setElementModel(thePlayer, 284) 
     outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) 
      elseif cmdName == "policeskin" then 
    if ID == "6" then 
     setElementModel(thePlayer, 288) 
     outputChatBox("You've chosen some police clothes.", thePlayer, 255, 0, 0) 
     else 
    outputChatBox("You are not a police,(( Open forum to applicate for Police job.))", thePlayer, 255, 0, 0) 
 end 
end 
end 
end 
end 
end 
end 
end 
end 
end 
end 
addCommandHandler("policeskin", policeSkins) 
     
     
    Policeduty = createMarker (   230.9375 , 79.0517578125 , 1006.0390625 ,"cylinder", 2, 255, 255, 0, 90) 
    setElementInterior (Policeduty, 6) 
    setElementDimension (Policeduty, 1) 
    function inDutyTell (hitPlayer,dimension) 
    outputChatBox("Type /duty to start the police job.", source) 
    addEventHandler("onMarkerHit",Policeduty,inDutyTell) 
     
        function duty(thePlayer,matchingDimension) 
        policeman = getPlayerFromName(thePlayer) 
    policemanTeam = getPlayerTeam(policeman) 
    if isElementWithinMarker(thePlayer, Policeskin) then 
    if (policemanTeam == "Police") then 
    if (getElementModel(thePlayer) == 280 or getElementModel(thePlayer) == 281 or getElementModel(thePlayer) == 282 or getElementModel(thePlayer) == 283 or getElementModel(thePlayer) == 284 or getElementModel(thePlayer) == 288) then 
     outputChatBox("You're now in duty as a police.", thePlayer, 255, 0, 0) 
 else 
    outputChatBox("You have to wear police clothes first", thePlayer, 255, 0, 0) 
 end 
 end 
 end 
 end 
end 
addCommandHandler("duty", duty) 

Error:Warning: /server.lua:73: Bad argument @ `addCommandHandler`

[Expected function at arguemnt 2, got nil]

Warning: /server.lua:97: Bad argument @ `addCommandHandler`

[Expected function at arguemnt 2, got nil]

Link to comment

You may have mixed up the amount of end like you did with the variable names, try to use indentation in your code like this:

function doSomething(player, cmd) 
    if player then 
        if cmd then 
            -- Just to show how indentation works, way more easy to read now. 
        end 
    end 
end 

The errors you receive doesn't seems to be a part of your code either, only the first one at the bottom but it will be easier to find out with some indentation and better names on your variables.

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