Jump to content

[HELP]Medic Job


ViRuZGamiing

Recommended Posts

Hello Community,

Please don't say I s*ck, i'm new to script and learning.

But it don't work my script.

I triggered as much as I could and went to Wiki every 5 secs.

So I hope you guys can help me as last option.

My Script

SERVER SIDED:

local theMarker = createMarker ( -2643, 639, 15, "cylinder", 1, 0, 0, 200, 170 ) -- creates the marker 
  
function MarkerHit ( hitElement, matchingDimension ) 
    local elementType = getElementType( hitElement ) 
    setGUIvisable ("Panel") -- sets the triggered GUI visable 
    triggerClientEvent() -- Triggers the GUI see Client 
end 
  
addEventHandler( "onMarkerHit", myMarker, MarkerHit ) 
  
function createCar 
    local createVehicle (416, -2591 584 15) -- ID X Y and Z 
    setPedIntoCar(createVehicle) -- Warps the Player into the Created Car 
end 
  
function setTeam 
    onGUIclick(bAccept) then 
    setPlayerTeam("Medic") 
    if getPlayerTeam = Medic then 
    outputChatBox("You are already an Medic") 
end 
  
-- Adds the Command for Medic members to heal players 
  
local range = 50 
addCommandHandler('heal', -- creates the command /heal 
    function(p,c,who) 
        local who = getPlayerFromName(who) 
        if who then 
            local mx,my,mz = getElementPosition(p) 
            local ux,uy,uz = getElementPosition(who) 
            if getDistanceBetweenPoints3D(mx,my,mz,ux,uy,uz) <= range then 
                if getPlayerTeam(p) == getTeamFromName("Medic") then -- only for medics able 
                    setElementHealth(who, 100) -- sets full health 
                    setPlayerMoney(who, -100) -- Takes 100$ for healing 
                end 
            else 
                outputChatBox("This player is too far away",p,0,0,225) 
            end 
        else 
            outputChatBox('Player not found.',p,0,0,255) 
        end 
    end 
) 
  

CLIENT SIDED:

GUIEditor = { 
    memo = {}, 
    button = {}, 
    window = {}, 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0.29, 0.24, 0.42, 0.49, "", true) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1], false) 
  
        bAccept = guiCreateMemo(0.08, 0.20, 0.41, 0.67, "", true, GUIEditor.window[1]) 
         
        bAccept = guiCreateButton(0.60, 0.20, 0.34, 0.17, "Accept Job", true, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "sa-header") 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") 
        addEventHandler("onClientGUIClick", bAccept, showGUIbf, false) 
        addEventHandler("onClientGUIClick", bAccept, joinTeam, false) 
         
        bClose = guiCreateButton(0.67, 0.61, 0.20, 0.16, "CLOSE", true, GUIEditor.window[1]) 
        guiSetProperty(bClose, "NormalTextColour", "FFAAAAAA")  
        addEventHandler("onClientGUIClick", bClose, showGUIbf, false) 
         
        GUIEditor.memo[1] = guiCreateMemo(0.08, 0.20, 0.41, 0.67, "Become a Medic and heal people by using the command /heal player !", true, GUIEditor.window[1]) 
         
    end 
  
triggerServerEvent("theMarker") 
triggerServerEvent("createCar") 
triggerServerEvent("setTeam") 
end 
  
  

I know this isn't good but I tried and I know people who just give up but I tried.

Thanks for Helping already and be kind with reply's

Link to comment

No offence Billy but the whole thing is a mess...

u have client side functions in ur server side script, incomplete functions and errors in a lot of the script throughout.

if i go ahead and fix it u wont learn a thing...

so: look at these parts...

the function from line 4 onwards is incomplete.

line 5: this should be clientside and 'guiSetVisible'

line 6: incomplete

line 11: missing parameters

line 13: incorrect function - warpPedIntoVehicle

line 17: clientside and wrong.

line 16: setTeam function is incomplete

im guessing lines 25 onwards arent yours, even so, theres an error in line 35

clientside:

lines 29,30,31..... wrong

the rest of the script is missing.....

If ur scripting, dont go to the wiki every 5 seconds...

just keep it open until u memorise every function/parameter... (which u probably never will)

the wiki is a bible for scripters!dont script without it :)

Link to comment

Your script has more than a few mistakes...

since you dont even know the basics, making triggers back and fourth from client and server and adding all this stuff wrong makes it almost impossible to explain to u how to fix it... especially when you cant even make a simple function.

it seems ur trying to run and u cant even crawl yet.

example:

function createCar
after under 1 hour of scripting or a few mins browsing the wiki

u can see this function is already wrong... its missing the parameters...

maybe u should learn something basic first?

like how to output a line of text into the server withj some parameters.

then make a small function to change a players team.

then make the spray can heal people if theyre on a set team.

then make a basic gui that works.

when u can do these things, come back to ur script and im sure u will understand so much better.

we could fix ur script but then next week you would be back wanting something else 'fixing'

Link to comment

I already made a working Gate script, Pay 'n Spray and Team script.

Gate opens and closes on command

Pay 'n spray repairs car for a price,

The price affect from damage, frozen while repairing.

Team script let you join a team on command and sets skin, team and weapons.

The only thing I have problems with is GUI.

I know how to make a server side and a GUI with guieditor but pasting the GUI code isn't enough.

Link to comment
I already made a working Gate script, Pay 'n Spray and Team script.

If you can do so much, why do u write like this:

function createCar 
    local createVehicle (416, -2591 584 15) -- ID X Y and Z 
    setPedIntoCar(createVehicle) -- Warps the Player into the Created Car 
end 

every line is wrong apart from 'end'.

this is 'one of' the most basic functions possible... and you cant even get that right.

ive wasted enough time here... seems u dont want helping.

Good luck with your script.

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