Jump to content

If not deathmatch


FuriouZ

Recommended Posts

How to to if player is not in deathmatch team, then

    showPlayerHudComponent ( source, "ammo", true ) 
    showPlayerHudComponent ( source, "weapon", true ) 

are false ?

and another question, how to set pickup dimension ?

server:

local rRoot = resourceRoot 
  
MP5 = createPickup ( 360.56104, -2072.92627, 10.69531, 2, 29, 100 ) -- create myPickup at resource start 
function giveMP5 () 
    giveWeapon ( source, 29, 200 ) -- Gives the M4 weapon with 200 ammo 
end 
addEventHandler("onClientPickupHit", root,MP5, giveMP5) 
  
  

thanks

Link to comment
1. getTeamName ( getPlayerTeam ( source ) ) == ""

2. setElementDimension

Both doesn't work :

local g_Root_Element = getRootElement ( ) 
  
------------------- 
--Get_Player_Team-- 
------------------- 
function isDeathmatchTeam () 
    local team = getPlayerTeam(localPlayer) 
    local DeathmatchTeam = getTeamFromName("Deathmatch Arena") 
    if team and DeathmatchTeam then 
        showPlayerHudComponent ( source, "ammo", true ) 
        showPlayerHudComponent ( source, "weapon", true )   
    else 
        showPlayerHudComponent ( source, "ammo", false ) 
        showPlayerHudComponent ( source, "weapon", false ) 
    end 
end 
addEventHandler ( "onResourceStart", g_Root_Element, isDeathmatchTeam ) 
---------------------- 
--Deathmatch_Weapons-- 
---------------------- 
  
MP5 = createPickup ( 360.56104, -2072.92627, 10.69531, 2, 29, 100 ) 
function giveMP5 () 
    giveWeapon ( source, 29, 300 ) 
end 
addEventHandler("onClientPickupHit", root,MP5, giveMP5) 
--weapon is still in dimension 0 
function setRightDimension () 
    setElementDimension ( MP5, 3 )  
end 
addEventHandler ( "onResourceStart", g_Root_Element, setRightDimension ) 
  

Link to comment
Cause of your if-statement here;
if team and DeathmatchTeam then 

should be;

if ( team ) then 
if ( team == DeathmatchTeam ) then 

but not sure whats wrong with the dimension, getting any error like; bad argument @?

This is server side:

Debug says bad argument @getPlayerTeam (line 7)

dimension debug says bad argument @addEventHandler[expected function at argument 3,got pickup] --Line 28

local g_Root_Element = getRootElement ( ) 
  
------------------- 
--Get_Player_Team-- 
------------------- 
function isDeathmatchTeam () 
    local team = getPlayerTeam(localPlayer) --Line 7 
    local DeathmatchTeam = getTeamFromName("Deathmatch Arena") 
        if ( team ) then 
            if ( team == DeathmatchTeam ) then 
        showPlayerHudComponent ( source, "ammo", true ) 
        showPlayerHudComponent ( source, "weapon", true )   
    else 
        showPlayerHudComponent ( source, "ammo", false ) 
        showPlayerHudComponent ( source, "weapon", false )    
   end 
   end 
end 
addEventHandler ( "onResourceStart", g_Root_Element, isDeathmatchTeam ) 
---------------------- 
--Deathmatch_Weapons-- 
---------------------- 
  
MP5 = createPickup ( 360.56104, -2072.92627, 10.69531, 2, 29, 100 ) 
function giveMP5 () 
    giveWeapon ( source, 29, 300 ) 
end 
addEventHandler("onClientPickupHit", root,MP5, giveMP5) --Line 28 
  
function setRightDimension () 
    setElementDimension ( MP5, 3 )  
end 
addEventHandler ( "onResourceStart", g_Root_Element, setRightDimension ) 
  
  

Link to comment
  • Moderators

line 7 isn't serverside. (localPlayer isn't serverside)

    local team = getPlayerTeam(localPlayer) --Line 7 

Line 28, is a client event.

addEventHandler("onClientPickupHit", root,MP5, giveMP5) --Line 28 

The source of line 11,12,14 and 15 isn't a player.

        showPlayerHudComponent ( source, "ammo", true ) 
        showPlayerHudComponent ( source, "weapon", true )   
    else 
        showPlayerHudComponent ( source, "ammo", false ) 
        showPlayerHudComponent ( source, "weapon", false )  

onResourceStart

The source of this event is the root element in the resource that started.

Link to comment

Still don't get it right ..

line 6: Bad 'player' pointer @ 'getPlayerTeam'(1)

local g_Root_Element = getRootElement ( ) 
------------------- 
--Get_Player_Team-- 
------------------- 
function isDeathmatchTeam (source, team, thePlayer) 
    local team = getPlayerTeam ( source )   
    local DeathmatchTeam = getTeamFromName("Deathmatch Arena") 
        if ( team ) then 
            if ( team == DeathmatchTeam ) then 
        showPlayerHudComponent ( thePlayer, "ammo", true ) 
        showPlayerHudComponent ( thePlayer, "weapon", true )   
    else 
        showPlayerHudComponent ( thePlayer, "ammo", false ) 
        showPlayerHudComponent ( thePlayer, "weapon", false )    
   end 
   end 
end 
addEventHandler ( "onResourceStart", g_Root_Element, isDeathmatchTeam ) 
---------------------- 
--Deathmatch_Weapons-- 
---------------------- 
  
MP5 = createPickup ( 360.56104, -2072.92627, 10.69531, 2, 29, 100 ) 
function giveMP5 () 
    giveWeapon ( source, 29, 300 ) 
end 
addEventHandler("onPickupHit", root,MP5, giveMP5) 
  
function setRightDimension () 
    setElementDimension ( MP5, 3 )  
end 
addEventHandler ( "onResourceStart", g_Root_Element, setRightDimension ) 
  
  

Link to comment
  • Moderators

You can't just add random player arguments when a resource starts, wtf?

You should start learning the basic of scripting, this isn't going to work.

and how you solve it, is by reading wiki mta instead of doing the "wtf".

https://wiki.multitheftauto.com/wiki/Main_Page

https://wiki.multitheftauto.com/wiki/Main_Page

https://wiki.multitheftauto.com/wiki/Main_Page

https://wiki.multitheftauto.com/wiki/Main_Page

Link to comment
You can't just add random player arguments when a resource starts, wtf?

You should start learning the basic of scripting, this isn't going to work.

and how you solve it, is by reading wiki mta instead of doing the "wtf".

https://wiki.multitheftauto.com/wiki/Main_Page

https://wiki.multitheftauto.com/wiki/Main_Page

https://wiki.multitheftauto.com/wiki/Main_Page

https://wiki.multitheftauto.com/wiki/Main_Page

I tought this is place, where i can get help.. but okay then.

Link to comment
  • Moderators

This isn't help, this is making a free script for you.

I have showed you a lot of those problems, but you aren't reading my notes.

You also don't ask questions why some things don't work, you are uninterested in lua and only interested in the scripts.

I can't help somebody with 1% knowledge about lua. You just copy every line from wiki, mix them up somehow and say: here is my code, can you fix it pls!?!

But actuality you say: "here are a few lines, make me a code"

Link to comment
This isn't help, this is making a free script for you.

I have showed you a lot of those problems, but you aren't reading my notes.

You also don't ask questions why some things don't work, you are uninterested in lua and only interested in the scripts.

I can't help somebody with 1% knowledge about lua. You just copy every line from wiki, mix them up somehow and say: here is my code, can you fix it pls!?!

But actuality you say: "here are a few lines, make me a code"

No.You are totally wrong.Well, yeah i am not so good in scripting like you maybe .. but i am still learning it ,so if yo don't want to help me, you don't have to, but don't come to say me things what you don't know about me. Little off-topic, but don't post here anymore.

Thanks

Link to comment
  • Moderators

I know what you show me and that was my conclusion. If it wasn't true then you wouldn't have 2 repliers, but many more. I won't reply on your topics as you won't reply on mine. Don't reply on this reply, because I will be the last person that make THAT reply.

Have a nice day,

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