Jump to content

robber error


Monty

Recommended Posts

hi it's me again... hi have a little problem with my script...

server-side:

function createRobberTeam () 
    robberTeam = createTeam ( "Robber", 250, 0, 0 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createRobberTeam ) 
  
function givePlayerJob ( ) 
    setPlayerTeam ( localPlayer, robberTeam ) 
end 
addCommandHandler ( "robber", givePlayerJob ) 
  
addEvent ( "givePlayerPay", true ) 
function givePlayerRobPay () 
    money = math.random ( 350, 1020 ) 
     givePlayerMoney ( source, money ) 
      outputChatBox ( "You succesfully robbed the house and made $" ..money, source ) 
       fadeCamera ( source, false, 1, 0, 0, 0 ) 
        setTimer ( fadeCamera, 1000, 1, source, true, 1 ) 
end 
addEventHandler ( "givePlayerPay", root, givePlayerRobPay ) 

client-side:

addEvent ( "createHouseEvent", true ) 
function createHouses () 
    x, y, z = unpackRobberHouses () 
     robhouseMarker = createMarker ( x, y, z, "cylinder", 3, 255, 51, 102, 85, localPlayer ) 
      robhouseBlip = createBlipAttachedTo ( robhouseMarker, 32, localPlayer ) 
end 
addEventHandler ( "createHouseEvent", root, createHouses ) 
  
addEventHandler ( "onClientMarkerHit", root, 
    function ( hitElement ) 
        if ( source == robhouseMarker and not isPedInVehicle ( localPlayer ) and hitElement == localPlayer ) then 
            triggerServerEvent ( "givePlayerPay", localPlayer ) 
         destroyElement ( robhouseMarker ) 
           destroyElement ( robhouseBlip ) 
            triggerEvent ( "createHouseEvent", localPlayer ) 
             playSound ( "files/cash.mp3", false ) 
        end 
    end 
) 
  
addEventHandler ( "onClientPedDamage", resourceRoot, 
    function () 
        cancelEvent () 
    end 
) 

Link to comment
hi it's me again... hi have a little problem with my script...

server-side:

function createRobberTeam () 
    robberTeam = createTeam ( "Robber", 250, 0, 0 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createRobberTeam ) 
  
function givePlayerJob ( thePlayer) 
    setPlayerTeam ( thePlayer, robberTeam ) 
end 
addCommandHandler ( "robber", givePlayerJob ) 
  
addEvent ( "givePlayerPay", true ) 
function givePlayerRobPay () 
    money = math.random ( 350, 1020 ) 
     givePlayerMoney ( source, money ) 
      outputChatBox ( "You succesfully robbed the house and made $" ..money, source ) 
       fadeCamera ( source, false, 1, 0, 0, 0 ) 
        setTimer ( fadeCamera, 1000, 1, source, true, 1 ) 
end 
addEventHandler ( "givePlayerPay", root, givePlayerRobPay ) 

client-side:

addEvent ( "createHouseEvent", true ) 
function createHouses () 
    x, y, z = unpackRobberHouses () 
     robhouseMarker = createMarker ( x, y, z, "cylinder", 3, 255, 51, 102, 85, localPlayer ) 
      robhouseBlip = createBlipAttachedTo ( robhouseMarker, 32, localPlayer ) 
end 
addEventHandler ( "createHouseEvent", root, createHouses ) 
  
addEventHandler ( "onClientMarkerHit", root, 
    function ( hitElement ) 
        if ( source == robhouseMarker and not isPedInVehicle ( localPlayer ) and hitElement == localPlayer ) then 
            triggerServerEvent ( "givePlayerPay", localPlayer ) 
         destroyElement ( robhouseMarker ) 
           destroyElement ( robhouseBlip ) 
            triggerEvent ( "createHouseEvent", localPlayer ) 
             playSound ( "files/cash.mp3", false ) 
        end 
    end 
) 
  
addEventHandler ( "onClientPedDamage", resourceRoot, 
    function () 
        cancelEvent ( createHouseEvent ) 
    end 
) 

localPlayer is not SERVER Element

Edited by Guest
Link to comment
hi it's me again... hi have a little problem with my script...

server-side:

function createRobberTeam () 
    robberTeam = createTeam ( "Robber", 250, 0, 0 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createRobberTeam ) 
  
function givePlayerJob ( thePlayer) 
    setPlayerTeam ( thePlayer, robberTeam ) 
end 
addCommandHandler ( "robber", givePlayerJob ) 
  
addEvent ( "givePlayerPay", true ) 
function givePlayerRobPay () 
    money = math.random ( 350, 1020 ) 
     givePlayerMoney ( source, money ) 
      outputChatBox ( "You succesfully robbed the house and made $" ..money, source ) 
       fadeCamera ( source, false, 1, 0, 0, 0 ) 
        setTimer ( fadeCamera, 1000, 1, source, true, 1 ) 
end 
addEventHandler ( "givePlayerPay", root, givePlayerRobPay ) 

client-side:

addEvent ( "createHouseEvent", true ) 
function createHouses () 
    x, y, z = unpackRobberHouses () 
     robhouseMarker = createMarker ( x, y, z, "cylinder", 3, 255, 51, 102, 85, localPlayer ) 
      robhouseBlip = createBlipAttachedTo ( robhouseMarker, 32, localPlayer ) 
end 
addEventHandler ( "createHouseEvent", root, createHouses ) 
  
addEventHandler ( "onClientMarkerHit", root, 
    function ( hitElement ) 
        if ( source == robhouseMarker and not isPedInVehicle ( localPlayer ) and hitElement == localPlayer ) then 
            triggerServerEvent ( "givePlayerPay", localPlayer ) 
         destroyElement ( robhouseMarker ) 
           destroyElement ( robhouseBlip ) 
            triggerEvent ( "createHouseEvent", localPlayer ) 
             playSound ( "files/cash.mp3", false ) 
        end 
    end 
) 
  
addEventHandler ( "onClientPedDamage", resourceRoot, 
    function () 
        cancelEvent ( createHouseEvent ) 
    end 
) 

localPlayer is not SERVER Element

Its full code!

Link to comment
--serverSide 
function createRobberTeam () 
    robberTeam = createTeam ( "Robber", 250, 0, 0 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createRobberTeam ) 
  
function givePlayerJob ( ) 
    setPlayerTeam ( source, robberTeam ) 
end 
addCommandHandler ( "robber", givePlayerJob ) 
  
addEvent ( "givePlayerPay", true ) 
  
function givePlayerRobPay () 
    money = math.random ( 350, 1020 ) 
     givePlayerMoney ( source, money ) 
      outputChatBox ( "You succesfully robbed the house and made $" ..money, source ) 
       fadeCamera ( source, false, 1, 0, 0, 0 ) 
        setTimer ( fadeCamera, 1000, 1, source, true, 1 ) 
end 
addEventHandler ( "givePlayerPay", root, givePlayerRobPay ) 
  
--ClientSide 
  
addEvent ( "createHouseEvent", true ) 
function createHouses () 
    x, y, z = unpackRobberHouses () 
     robhouseMarker = createMarker ( x, y, z, "cylinder", 3, 255, 51, 102, 85, localPlayer ) 
      robhouseBlip = createBlipAttachedTo ( robhouseMarker, 32, localPlayer ) 
end 
addEventHandler ( "createHouseEvent", root, createHouses ) 
  
addEventHandler ( "onClientMarkerHit", root, 
    function ( hitElement ) 
        if ( source == robhouseMarker and not isPedInVehicle ( localPlayer ) and hitElement == localPlayer ) then 
            triggerServerEvent ( "givePlayerPay", localPlayer ) 
         destroyElement ( robhouseMarker ) 
           destroyElement ( robhouseBlip ) 
            triggerEvent ( "createHouseEvent", localPlayer ) 
             playSound ( "files/cash.mp3", false ) 
        end 
    end 
) 
  
function pro () 
cancelEvent()  
end 
addEventHandler ( "onClientPedDamage", getRootElement(), pro ) 

Link to comment

maybe, cba thinking atm:

client:

--[[ 
  
Developer: Sebastian 'seb' Cronberg 
Rights: All rights reserved by the developer (c) 2012 
File: robber_client.lua 
  
]] 
local robberHouses = 
{ 
    { 1231, 123, 123 }; -- change to your values. 
} 
  
function unpackRobberHouses () 
    return unpack ( robberHouses [ math.random ( #robberHouses ) ] ) 
end 
  
addEvent ( "createHouseEvent", true ) 
function createHouses () 
    x, y, z = unpackRobberHouses () 
     robhouseMarker = createMarker ( x, y, z, "cylinder", 3, 255, 51, 102, 85, localPlayer ) 
     robhouseBlip = createBlipAttachedTo ( robhouseMarker, 32, localPlayer ) 
end 
addEventHandler ( "createHouseEvent", root, createHouses ) 
  
addEventHandler ( "onClientMarkerHit", root, 
    function ( hitElement ) 
        if ( source == robhouseMarker and not isPedInVehicle ( localPlayer ) and hitElement == localPlayer ) then 
            triggerServerEvent ( "givePlayerPay", localPlayer ) 
        destroyElement ( robhouseMarker ) 
        destroyElement ( robhouseBlip ) 
        triggerEvent ( "createHouseEvent", localPlayer ) 
        playSound ( "files/cash.mp3", false ) 
        end 
    end 
) 
  
function triggerServer () 
    triggerEvent ( "createHouseEvent", localPlayer ) 
    triggerServerEvent ( "robberJobAccepted", localPlayer ) 
end 
addCommandHandler ( "criminal", triggerServer ) 

server:

--[[ 
  
Developer: Sebastian 'seb' Cronberg 
Rights: All rights reserved by the developer (c) 2012 
File: ronbber_server.lua 
  
]] 
  
function createRobberTeam () 
    robberTeam = createTeam ( "Robber", 250, 0, 0 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, createRobberTeam ) 
  
addEvent ( "robberJobAccepted", true ) 
function givePlayerJob ( ) 
    setPlayerTeam ( source, robberTeam ) 
end 
addEventHandler ( "robberJobAccepted", root, givePlayerJob ) 
  
addEvent ( "givePlayerPay", true ) 
function givePlayerRobPay () 
    money = math.random ( 350, 1020 ) 
     givePlayerMoney ( source, money ) 
     outputChatBox ( "You succesfully robbed the house and made $" ..money, source ) 
     fadeCamera ( source, false, 1, 0, 0, 0 ) 
     setTimer ( fadeCamera, 1000, 1, source, true, 1 ) 
end 
addEventHandler ( "givePlayerPay", root, givePlayerRobPay ) 

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