Jump to content

False weapons? O.o wtf?!


Recommended Posts

Hi i have problem with this code:


function kill( totalAmmo, killer, killerWeapon, bodypart ) 
if getPlayerTeam(source) == team1 then 
elseif getPlayerTeam(source) == team2 then 

Respawn function:

function team1spawn() 
    currentmap = call(getResourceFromName"mapmanager","getRunningGamemodeMap") 
    local mapinterior = get(getResourceName(currentmap)..".#interior") 
    if mapinterior == false then  
        mapinterior = 0 
    mercpoints = getElementsByType ( "team1s", mapRoot or getRootElement() ) 
    local random = math.random ( 1, table.getn ( mercpoints ) ) 
    local posX = getElementData(mercpoints[random], "posX")  
    local posY = getElementData(mercpoints[random], "posY")  
    local posZ = getElementData(mercpoints[random], "posZ") 
    local skin = getElementData(mercpoints[random], "skin") 
    local rot = getElementData(mercpoints[random], "rot") or getElementData(mercpoints[random], "rotZ") or 0 
    spawnPlayer ( source, posX, posY, posZ, rot, skin, mapinterior ) 
    --setCameraMode ( source, "player" ) 
    setCameraTarget ( source, source) 
--outputChatBox("Welcome to '"..getTeamName(team1).."' team",thisplayer,255,30,0) 
    setPedFightingStyle ( source, 7 ) 
addEventHandler ( "team1spawn", getRootElement(), team1spawn) 

Giving the guns:

function gearup (thisplayer,team) 
    setElementAlpha ( thisplayer, 255 ) 
if team == "team1" then 
        weapon1s = getElementsByType ( "weapon1s", mapRoot or getRootElement() ) 
    for i,weapon1st in pairs(weapon1s) do 
    local id = getElementData(weapon1st, "model") 
        local ammo = getElementData(weapon1st, "ammo") 
        giveWeapon ( thisplayer, tonumber(id), tonumber(ammo),true ) 
elseif team == "team2" then 
weapon2s = getElementsByType ( "weapon2s", mapRoot or getRootElement() ) 
    for i,weapon2st in pairs(weapon2s) do 
    local id = getElementData(weapon2st, "model") 
        local ammo = getElementData(weapon2st, "ammo") 
        giveWeapon ( thisplayer, tonumber(id), tonumber(ammo),true ) 
addEventHandler ( "givetheguns", getRootElement(), gearup ) 

Now, i used givethe guns in the spawn function, everything working but when player1 kills player2 is respawn.

But when killed player (player2) wants to shoot player1 don't see it and dont hurt (it looks like giveWeapon in client side)

o.O what is wrong?!

Here is simple map code of weapon:

    <weapon1s id="weapon1s (AK-47) (1)" model="30" ammo="200"></weapon1s> 

Help me! :shock:

Link to comment
  • Moderators

maybe bullet sync will solve it, (server mtaserver.conf)

I can't see the bug, is the weapon invisible or the bullets invisible or both?

Btw try to reduce using element data, it will totally generate teleportation, trust me.

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