PLEASE help

my lua file has something wrong with it can you help
when i type its file name into console it just comes up with well done you have survived even if im dead how can i fix this please help
btw thats the file right there thanks

alive = true
if alive == true then
Msg(" well done you have survived!")
elseif alive == false then
Msg(“you are DEAD not big surprise”)
end


Take a look at your “alive” variable.
You set it to true.
Always.
So it will always message “you have survived.”

To determine if a player is alive, you can use **[Player.Alive

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.Alive)**.

Or more simply…

[lua]function HasSurvived( pl ) pl:ChatPrint( pl:Alive() and “Well done!” or “You suck!” ) end[/lua]

[lua] function Alive( ply )
if ply:Alive() then
Msg( “Well done you have survived!” )
else
Msg( “You! yes you! you are dead! not big surprise!” )
end
end
[/lua]

YAY thanks guys ive only just started lua like 3 hours ago but i think im learning thanks so much

[editline]05:41PM[/editline]

hmm its coming up with this error in blue writing
[lua_run:1] ‘=’ expected near ‘<eof>’

[editline]05:51PM[/editline]

god this is getting annoying

ok i changed the script to this

function checkAlive(AUSTENxTHExNINJA)
if ply:Alive() then //Returns Boolean
ply:ChatPrint(’“YOU ARE STILL ALIVE WELL DONE”’) //If true (You are Alive)
else
//If not (You are Dead)
ply:ChatPrint(’"\YOU, YES YOU, YOU ARE DEAD HAHA/"’)
end //End If statement
end //End Function

but it has the same error [lua_run:1] ‘=’ expected near ‘<eof>’ if you can help you are a legend for ever this is really annoying me now

[lua]function checkAlive(AUSTENxTHExNINJA)
if AUSTENxTHExNINJA:Alive() then //if your alive run it
AUSTENxTHExNINJA:ChatPrint(“YOU ARE STILL ALIVE WELL DONE”) // prints if you’re alive
else // if you dead then run it
AUSTENxTHExNINJA:ChatPrint(“YOU, YES YOU, YOU ARE DEAD HAHA”) // prints dead chat
end //End If statement
end //End Function
[/lua]

:frowning: it still come up with the same error [lua_run:1] ‘=’ expected near ‘<eof> :’(

If your trying to open your script using lua_run you should be using lua_openscript(_cl)

when i do that al it says is running alive… and nothing happens

Your function isnt being ran, at the bottom try adding.

concommand.Add(“AmIAlive”, checkAlive)

and then run the script and type AmIAlive into your console followed by entering the enter key.

sorry could you explain that in detail like at the bottom off what do i type concommand sorry im begginer to all this

[lua]
function checkAlive(AUSTENxTHExNINJA)
if AUSTENxTHExNINJA:Alive() then //if your alive run it
AUSTENxTHExNINJA:ChatPrint(“YOU ARE STILL ALIVE WELL DONE”) // prints if you’re alive
else // if you dead then run it
AUSTENxTHExNINJA:ChatPrint(“YOU, YES YOU, YOU ARE DEAD HAHA”) // prints dead chat
end //End If statement
end //End Function
concommand.Add(“AmIAlive”, checkAlive)
[/lua]

And then run the consolecommand “AmIAlive”

OMG THANK YOU SO MUCH also is there any way to make it self open?? like say when i die you are dead

Instead of the concommand.Add line have

hook.Add(“PlayerDeath”, “DeathMessage”, checkAlive)

WOW thanks for all the help :smiley: