Jump to content

Problema con getPlayerTeam


Alexs

Recommended Posts

Posted

Buenas Tardes a Todos, Logre hacer funcionar mi script de Infeccion pero ahora tengo un Problema, Se supone que si eres un Zombie no deberias poder Subir a un auto ni disparar y hay cierta conversion en mi Godresource, pero hay un problema con esto:

  
--God resource 
function godsync ( attacker ) 
local tat = getPlayerTeam(attacker) 
local tatn = getTeamName(tat) 
local tata = getPlayerTeam(source) 
local tatna = getTeamName(tata) 
  
          if ( tatn ~= "Infectados" ) and ( tatna ~= "Infectados" ) or not (attacker)  then 
      cancelEvent ( ) 
    end 
end 
addEventHandler("onPlayerDamage", getRootElement(), godsync) 
  
--Zombies no Conducen 
function zombiesnoconducen ( ) 
local tst = getPlayerTeam(source) 
local tstn = getTeamName(tst) 
     if ( tasn == "Infectados" ) then 
        cancelEvent() 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), zombiesnoconducen ) 
  
--Zombies no Disparan 
function zombiesnodisparan ( ) 
local tst = getPlayerTeam(source) 
local tstn = getTeamName(tst) 
     if (tstn == "Infectados") then 
if currentWeaponID == 22 or currentWeaponID == 23 or currentWeaponID == 24 or currentWeaponID == 25 or currentWeaponID == 26 or currentWeaponID == 27 or currentWeaponID == 28 or currentWeaponID == 29 or currentWeaponID == 32 or currentWeaponID == 30 or currentWeaponID == 31 or currentWeaponID == 33 or currentWeaponID == 34 or currentWeaponID == 35 or currentWeaponID == 36 or currentWeaponID == 37 or currentWeaponID == 38 or currentWeaponID == 16 or currentWeaponID == 17 or currentWeaponID == 18 or currentWeaponID == 39 or currentWeaponID == 41 or currentWeaponID == 42 or currentWeaponID == 43 or currentWeaponID == 40 then  
toggleControl ( source, "fire", false ) 
else 
toggleControl ( source, "fire", true ) 
        end 
    end 
end 
addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), zombiesnodisparan ) 

Con todos pasa lo mismo, dice "Bad 'player' pointer en getPlayerTeam, excepto el de disparar que no dice nada, Alguna idea?

Posted
  
  
function zombiesnoconducen ( ) 
local tst = getPlayerTeam(source) 
local tstn = getTeamName(tst) 
     if ( tstn == "Infectados" ) then 
        cancelEvent() 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), zombiesnoconducen ) 
  

Escribiste mal la condicion, pero igual siempre te conviene chequear esas cosas , porque suele pasar al scriptear.

El godmode no te anda?

Posted

No, eso esta bien el Godmode deberia ser: Si el atacante no es Zombie o si tu no eres Zombie se cancela el ataque, para lo de conducir es q si eres Infectado no puedas conducir y para lo de las armas deberia ser, si eres zombie y tu arma es M4 o AK-47 etc... se cancele el poder atacar (toggleControl) ese script q pusiste es para q si eres Infectado no mueras y yo busco lo contrario

Posted

Yo puse, que para cuando entra al auto y es infestado ... salga del auto.

El script que pusiste deberia funcionar, esta formulado como queres.

Si te aparece "Bad" pointer getPlayerTeam en "onPlayerDamage", significa que alguien perdio vida sin que no halla atacker. Se que vos pusiste que al no haber attacker se cancela el evento, pero por orden, se lee primero la variable "tat", entendes?

Posted

Corregi los autos y las armas, pero el GodMode sigue mal, intente asi:

function godsync ( attacker, weapon, bodypart, loss ) 
  
  if (attacker) then 
     tatn = getTeamName(getPlayerTeam(attacker)) 
  
     tatna = getTeamName(getPlayerTeam(source)) 
  
          if ( tatn ~= "Infectados" ) and ( tatna ~= "Infectados" )  then 
      cancelEvent ( ) 
        end 
    end 
end 
addEventHandler("onPlayerDamage", getRootElement(), godsync) 
  
function godsyncna ( attacker, weapon, bodypart, loss ) 
  
    if not (attacker) then 
        cancelEvent( ) 
    end 
end 
addEventHandler("onPlayerDamage", getRootElement(), godsyncna) 

Posted

Me pregunto, porque nadie lee la p*** wiki?

It should also be noted that canceling this event has no effect. Cancel the client-side event onClientPlayerDamage instead.
Posted

Lo note luego de postear, luego de un error escribiendo el Evento funciono :B lo subire a la comunidad luego de probarlo, el unico problema es que tengo que poner para que los usuarios no cambien su nombre

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...