Jump to content

Police Duty [MTA:Paradise]


Subtixx

Recommended Posts

I hope you can help me .. So I have now tried a command to the Factions scripts (client side) but there is always the fault call failed "string"?

Script:

function policeDuty(commandName) 
    if exports.factions:isPlayerInFactionType( getLocalPlayer(), 1) then 
        showCursor(true) 
        guiSetVisible(DutyWindow, true) 
    else 
        outputChatBox("Police Department fail!") 
    end 
    outputChatBox(tostring(exports.factions:isPlayerInFactionType( getLocalPlayer(), 1))) 
end 
addCommandHandler("pduty",policeDuty) 

And The images are not displayed ..

Script:

    Waffe1 = guiCreateButton(26,31,85,81,"Deagle",false,DutyWaffenWindow) 
    WaffeImg1 = guiCreateStaticImage(4,4,78,72,"images/DEAGLE.png",false,Waffe1) 

EDIT:

meta.xml:

  
    <script src="police/duty/duty_c.lua" type="client" /> 
    <script src="police/duty/duty.lua" type="server" /> 
    <file src="police/duty/images/280.png" /> 
    <file src="police/duty/images/281.png" /> 
    <file src="police/duty/images/282.png" /> 
    <file src="police/duty/images/284.png" /> 
  
    <file src="police/duty/images/DEAGLE.png" /> 
    <file src="police/duty/images/MP5.png" /> 
    <file src="police/duty/images/M4.png" /> 
    <file src="police/duty/images/SNIPER.png" /> 

Link to comment

yeah but in my script i tried to make this: (server-side)

function getTheFaction(thePlayer,factionID) 
    if isPlayerInFactionType(thePlayer,factionID) then 
        tempdata = 1 
    else 
        tempdata = 0     
    end 
    setElementData(thePlayer,"tempdata.factions",tostring(tempdata)) 
    --getPlayerFactions( thePlayer ) 
end 

but the answer was:

Police Department fail

false

Link to comment

Okay. I have made an GUI for the Duty (Weapons and Skins)

I want when a player type: /pduty and the Player is in the Faction Police that the GUI opens

EDIT:

but when the function isPlayerInFaction serverside how do i do that then?

Link to comment
-- server side 
addCommandHandler('pduty', 
     function(source) 
           if isPlayerInFaction(source, 1) then 
                 triggerClientEvent(source, 'showDutyGUI', source) 
           end 
      end 
) 

and then add the event 'showDutyGUI' and in that event show the gui

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