MatXpl Posted December 23, 2012 Share Posted December 23, 2012 Hi i have problem with this code: Respawn: function kill( totalAmmo, killer, killerWeapon, bodypart ) if getPlayerTeam(source) == team1 then triggerEvent("team1spawn",source) elseif getPlayerTeam(source) == team2 then triggerEvent("team2spawn",source) end end Respawn function: function team1spawn() currentmap = call(getResourceFromName"mapmanager","getRunningGamemodeMap") local mapinterior = get(getResourceName(currentmap)..".#interior") if mapinterior == false then mapinterior = 0 end 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) fadeCamera(source,true) setPlayerTeam(source,team1) gearup(source,"team1") --outputChatBox("Welcome to '"..getTeamName(team1).."' team",thisplayer,255,30,0) setPedFightingStyle ( source, 7 ) end 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 ) end 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 ) end end end 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) what is wrong?! Here is simple map code of weapon: <weapon1s id="weapon1s (AK-47) (1)" model="30" ammo="200"></weapon1s> Help me! Link to comment
Moderators IIYAMA Posted December 23, 2012 Moderators Share Posted December 23, 2012 Is player2 not death? I have that bug sometimes when I kill somebody at a bike, but than I don't see him at all. (with the stealth resource) But that's another story.... Link to comment
MatXpl Posted December 23, 2012 Author Share Posted December 23, 2012 dead player (player2) respawn good, but his weapons is like client side Link to comment
Moderators IIYAMA Posted December 23, 2012 Moderators Share Posted December 23, 2012 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
MatXpl Posted December 23, 2012 Author Share Posted December 23, 2012 its a weapon invisible, bullets too (ONLY FOR PLAYER1 AND AFTER RESPAWN P2), and when player2 (after respawn) wants to shoot he shooting but player1 see that player2 is punching and dont hurt him. Link to comment
Moderators IIYAMA Posted December 23, 2012 Moderators Share Posted December 23, 2012 and what happend when you change player1 to player2? Link to comment
MatXpl Posted December 23, 2012 Author Share Posted December 23, 2012 its only in game when i enter game i spawn with weapons all working, but when i dead, i respawn and function gearplayer() giveme weapons but now it looks like client side only i can see my weapons and when i shoot someone he dosnt loss hp Link to comment
Castillo Posted December 23, 2012 Share Posted December 23, 2012 I had this problem on my server, players couldn't hurt others because they didn't see the attacker's weapon at all, but the attacker did see it on his screen. How do you trigger: "givetheguns"? Link to comment
MatXpl Posted December 23, 2012 Author Share Posted December 23, 2012 im using just gearup(source,"team1") Solidsnake14 I have this same problem! How to resolve it ? Link to comment
MatXpl Posted December 23, 2012 Author Share Posted December 23, 2012 i found magic line in ctf resource local player = source -- its important. trust me. i added this, trigger to player not source, and.. ITS WORKING! magic Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now