Jump to content

Help :( my marker not working


Recommended Posts

Posted (edited)

[EDITED] Hi guys.

its been 3 weeks that i started learnin to script at mta wiki, soo i practically did a small postman job. Almost everything is workin fine but the big problem is when i hit the marker, nothing happens :oops::oops::oops:. i tried to look for the problem with debugscript 3, but no errors :(

wheni click the accept button, i get on the vehicle, and i can see the marker to go. but when i go there, and when i hit the marker, i dont get the money:(((( nothin happens :(

heres the code

client.lua :

postMarker = createMarker(1961.960,-1674.148,15, "cylinder", 1.0,0,125,0,50) 
createBlipAttachedTo(postMarker, 41) 
local locations = { { 571, -1307, 17 }, { 1001, -1043, 30 }, { 942, -1817, 12 }, { 1224, -1826, 13 }, { 1777, -1885, 13 } } 
function postmanGui () 
    postWindow = guiCreateWindow(0.325,0.325,0.35,0.25, "Postman job \"{SMILIES_PATH}/icon_biggrin.gif\" alt=\"\" title=\"Very Happy\" /> ", true) 
    btnAccept = guiCreateButton(0.415,0.7,0.25,0.2, "Accept",true, postWindow) 
    addEventHandler("onClientGUIClick",btnAccept,postAccept) 
    btnReject = guiCreateButton(0.715,0.7,0.25,0.2, "Reject", true, postWindow) 
    addEventHandler("onClientGUIClick",btnReject,postReject) 
    guiSetVisible(postWindow, false) 
end 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
        function () 
                postmanGui () 
        end 
) 
  
function markerhit(thePlayer, matchingDimension) 
    if ( thePlayer == getLocalPlayer() ) then 
        guiSetVisible(postWindow, true) 
        showCursor(true) 
    end 
end 
addEventHandler("onClientMarkerHit", postMarker, markerhit) 
  
function postReject () 
    guiSetVisible(postWindow, false) 
    showCursor(false) 
end 
addEvent("acceptDaJob", true) 
addEventHandler("acceptDaJob",root,postReject) 
function postAccept (thePlayer) 
    triggerServerEvent("givePostJob", getLocalPlayer(), getLocalPlayer() ) 
     
end 
  
function showmarker (thePlayer) 
    if (thePlayer == getLocalPlayer() ) then 
        local randomNumber = math.random(#locations) 
        daMarker = createMarker(locations [randomNumber] [1], locations [randomNumber] [2], locations [randomNumber] [3], "cylinder", 2, 255,0,0) 
        daBlip = createBlipAttachedTo( daMarker, 41) 
        addEventHandler("OnClientMarkerHit", daMarker, hitDaMarker) 
    end 
end  
  
addEvent("startingJob", true) 
addEventHandler("startingJob",root,showmarker) 
  
function hitDaMarker (hitElement) 
    if (hitElement == getLocalPlayer() ) then 
        triggerServerEvent("playamarker", hitElement, hitElement) 
    end 
end 
  
  
function destroydamarker (thePlayer) 
    if (thePlayer == getLocalPlayer()) then 
        if (isElement(daMarker)) then 
            destroyElement(daMarker) 
            destroyElement(daBlip) 
        end 
    end 
end 
addEvent("destroymarker",true) 
addEventHandler("destroymarker",root, destroydamarker) 
     

server.lua :

local allowedVehicles = { [586] = true } 
function myjob (thePlayer) 
    local postVehicle = createVehicle(586, 1948.318, -1674.251,13.546) 
    warpPedIntoVehicle(thePlayer, postVehicle) 
    triggerClientEvent("acceptDaJob",thePlayer, thePlayer ) 
    triggerClientEvent("startingJob", thePlayer, thePlayer) 
     
end 
addEvent("givePostJob", true) 
addEventHandler("givePostJob", root, myjob) 
  
  
  
addEvent("playamarker", true) 
addEventHandler("playamarker",root, 
    function (thePlayer) 
        local vehicle = getPedOccupiedVehicle ( thePlayer ) 
        if ( vehicle ) then 
            if ( allowedVehicles [ getElementModel ( vehicle ) ] ) then 
                if ( thePlayer == getVehicleOccupant ( vehicle, 0 ) ) then 
                    givePlayerMoney ( thePlayer, math.random ( 3000, 6000 ) ) 
                end 
            end 
        end 
    end 
) 

everythin is fine in meta.

also guys, i tried to learn by using runcodes :) and its fun, but some function doesnt work :((

1) cancelEvent("onPlayerDamage", duduRastaman)--- this doesnt work, and i get some errors that is hard to understand O_O

2)setElementAlpha(getPlayerFromName("duduRastaman", 0) -- this also doesnt work :'( -- even when i use getPlayerFromNick

codin is fun, only when ur code is workin

Help me guys :'(

Edited by Guest

Respect everyone

Be kind to all, even to animals

Be a real warrior, face all your problems with head held high

Believe in you.Believe in God, He's watching you and will always help. Just believe in you and Him

Posted

thnks bro :( but still not working. everything is workin fine, only when i hit the marker, nothin happens. i dont get the money :(((

Respect everyone

Be kind to all, even to animals

Be a real warrior, face all your problems with head held high

Believe in you.Believe in God, He's watching you and will always help. Just believe in you and Him

Posted

Ab-47, i just edited the post, cause i did not well explain my problem :(

Respect everyone

Be kind to all, even to animals

Be a real warrior, face all your problems with head held high

Believe in you.Believe in God, He's watching you and will always help. Just believe in you and Him

Posted
Ab-47, i just edited the post, cause i did not well explain my problem :(

Silly mistakes are always hidden :lol:

Change line 43:

addEventHandler("OnClientMarkerHit", daMarker, hitDaMarker) 

to this:

addEventHandler("onClientMarkerHit", daMarker, hitDaMarker) 

Your client event has a capial "O" which shouldn't be there xP tested & confirmed that it works :P

And now Aurora is back again, pm for more info.

Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA.

Ex. Developer at Community of Social Gamers - CSG

Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP

9o6E8.png Ab-47

Posted

ABBBBBBB 47 :D thnk u bro

lol that silly mistake.

but bro, can u tell me how to use setElementAlpha ingame with runcode, i cant use it idk why :(

my ingame name is duduRastaman and when i type run setElementAlpha(getPlayerFromName("duduRastaman", 0)

i get some errors which i cant understand :/

anyway, thnk u very much for ur reply bro :)

Respect everyone

Be kind to all, even to animals

Be a real warrior, face all your problems with head held high

Believe in you.Believe in God, He's watching you and will always help. Just believe in you and Him

Posted
but bro, can u tell me how to use setElementAlpha ingame with runcode, i cant use it idk why :(

my ingame name is duduRastaman and when i type run setElementAlpha(getPlayerFromName("duduRastaman", 0)

i get some errors which i cant understand :/

setElementAlpha(getPlayerFromName("duduRastaman"), 0) 

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

hey guys :) sorry for late reply.

i tried as far as i can but O_O i think its server problem, lots of runcode dont work!!! shit, but anyway, God bless u all, thnks breddas :D

Be blessed !!!

Respect everyone

Be kind to all, even to animals

Be a real warrior, face all your problems with head held high

Believe in you.Believe in God, He's watching you and will always help. Just believe in you and Him

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