Jump to content

Problem with godmode...


villr

Recommended Posts

Posted

Got a problem with my godmode script..

Part of server bit:

function staff ( source, commandName) 
   if isPlayerAdmin(source) then   
    setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam ( source, teamStaff ) 
    setPlayerWantedLevel ( source, 0 ) 
    takeAllWeapons ( source ) 
            giveWeapon ( source, 3, 1 ) 
            giveWeapon ( source, 17, 500 ) 
            giveWeapon ( source, 22, 700 ) 
            giveWeapon ( source, 24, 100 ) 
            giveWeapon (source, 27, 1000 ) 
            giveWeapon (source, 29, 1900 ) 
            giveWeapon (source, 31, 1500 ) 
            giveWeapon ( source, 34, 1500 ) 
            giveWeapon ( source, 39, 500 ) 
            giveWeapon ( source, 40, 5 ) 
    triggerClientEvent(source,"god_mode",source) 
            setElementHealth ( source, 1000 ) 
            setPlayerNametagColor ( source, 190, 200, 190 ) 
            setElementModel ( source, 165 ) 
        setPedArmor ( source, 1000 ) 
   else 
    outputChatBox ( "*" .. getPlayerName ( source ) .. "*  this command is only for Staff .",  source , 255,0,0 ) 
   end 
end 
addCommandHandler("staff", staff) 
 

Client:

addEvent("god_mode",true) 
addEventHandler("god_mode",getRootElement(), 
function () 
addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelEventEvent) 
end) 
  

Whats the problem with it?..

this is the error message:server triggered clientisde event god_mode, but event is not added clientside

Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS!

Scripted since summer 2010 :)

Posted

function staff ( thePlayer, commandName) 
   if isPlayerAdmin(thePlayer) then   
    setPlayerTeam ( thePlayer, teamStaff ) 
    setPlayerWantedLevel ( thePlayer, 0 ) 
    takeAllWeapons ( thePlayer ) 
            giveWeapon ( thePlayer, 3, 1 ) 
            giveWeapon ( thePlayer, 17, 500 ) 
            giveWeapon ( thePlayer, 22, 700 ) 
            giveWeapon ( thePlayer, 24, 100 ) 
            giveWeapon ( thePlayer, 27, 1000 ) 
            giveWeapon ( thePlayer, 29, 1900 ) 
            giveWeapon ( thePlayer, 31, 1500 ) 
            giveWeapon ( thePlayer, 34, 1500 ) 
            giveWeapon ( thePlayer, 39, 500 ) 
            giveWeapon ( thePlayer, 40, 5 ) 
            setElementHealth ( thePlayer, 1000 ) 
            setPlayerNametagColor ( thePlayer, 190, 200, 190 ) 
            setElementModel ( thePlayer, 165 ) 
            setPedArmor ( thePlayer, 1000 ) 
            triggerClientEvent(thePlayer,"god_mode",thePlayer) 
    else 
    outputChatBox ( "*" .. getPlayerName ( source ) .. "*  this command is only for Staff .",  thePlayer , 255,0,0 ) 
   end 
end 
addCommandHandler("staff", staff) 
  

P.S: Check your meta.xml and make sure client it's really a client side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

i have just moved this script from another scritp i had but i dunno if i forgot some parts but i dont think so but it dont work at all now when i changed beacuse that you posted dident help me ..

and the script is clientside dunno how it dident got :S

this is error:

WARNING: villrpg/rpg_c.lua:4 Bad argument @'addEventHandler'

Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS!

Scripted since summer 2010 :)

Posted (edited)

You got a function missing, try using this instead:

addEvent("god_mode",true) 
addEventHandler("god_mode",getRootElement(), 
function () 
addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelEvent) 
end) 

Edited by Guest

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Still dont work :(

Same error

Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS!

Scripted since summer 2010 :)

Posted (edited)

Try this

addEvent("god_mode",true) 
addEventHandler("god_mode",getRootElement(), 
function () 
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(),function() cancelEvent()  end)   
end) 

Edited by Guest

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

Posted

Villr, copy my code again, now it doesn't give anymore a bad argument.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Thank you castillo soo mutch :))

Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS!

Scripted since summer 2010 :)

Posted

No problem.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
-_- He made the function "isPlayerAdmin" you have to remove it and put your admin check.

stupid question but how to make an admin check? (duno in lua)

Posted

I've fixed that script but now have an error after i use "staff" command:

Error:

[2011-06-27 16:08:01] Starting god 
[2011-06-27 16:08:01] god restarted successfully 
[2011-06-27 16:08:10] ERROR: god\gods.lua:3: attempt to concatenate global 'playerName' (a nil value) 

My code:

function staff ( thePlayer, commandName) 
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Admin" ) ) then 
setElementHealth ( thePlayer, 1000 ) 
setPlayerNametagColor ( thePlayer, 190, 200, 190 ) 
setElementModel ( thePlayer, 165 ) 
setPedArmor ( thePlayer, 1000 ) 
triggerClientEvent(thePlayer,"god_mode",thePlayer) 
else 
outputChatBox ( "*" .. getPlayerName ( source ) .. "*  this command is only for Staff .",  thePlayer , 255,0,0 ) 
end 
end 
addCommandHandler("staff", staff) 

Posted

try:  

function staff ( thePlayer, commandName) 
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then 
setElementHealth ( thePlayer, 1000 ) 
setPlayerNametagColor ( thePlayer, 190, 200, 190 ) 
setElementModel ( thePlayer, 165 ) 
setPedArmor ( thePlayer, 1000 ) 
triggerClientEvent(thePlayer,"god_mode",thePlayer) 
else 
outputChatBox ( "*" .. getPlayerName ( source ) .. "*  this command is only for Staff .",  thePlayer , 255,0,0 ) 
end 
end 
addCommandHandler("staff", staff) 

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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