IT/isPlayerDead: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{IT/MainP}}
{{IT/Funzioni server client}}
{{IT/Funzioni server client}}
{{IT/MainP}}
__NOTOC__
__NOTOC__
Questa funzione verifica se un giocatore è morto o meno.
Questa funzione verifica se un [[IT/Elemento/Player|giocatore]] è morto o meno.


==Sintassi==  
==Sintassi==  
Line 8: Line 8:


===Argomenti richiesti===  
===Argomenti richiesti===  
*'''thePlayer:''' Il [[IT/player|player]] di cui vuoi verificare la morte.
*'''thePlayer:''' Il [[IT/Elemento/Player|player]] di cui vuoi verificare la morte.


===Valori restituiti===
===Valori restituiti===
Line 15: Line 15:
==Esempio==
==Esempio==
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
Questo esempio permette a un giocatore di usare il comando 'sonomorto' per verificare se è morto o meno.
Questo esempio permette a un giocatore di usare il comando 'sonomorto' per verificare se sia morto o meno.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--Verifica se il giocatore è morto meno e mostra un messaggio nella chatbox
--Verifica se il giocatore è morto meno e mostra un messaggio nella chatbox
Line 29: Line 29:
</section>
</section>
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
Questo esempio permette a un giocatore di usare il comando 'sonomorto' per verificare se è morto o meno.
Questo esempio permette a un giocatore di usare il comando 'sonomorto' per verificare se sia morto o meno.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--Check if player is alive or dead and let them know in the chat box
--Check if player is alive or dead and let them know in the chat box

Latest revision as of 19:42, 13 June 2008

« Torna alla Pagina principale italiana .


Questa funzione verifica se un giocatore è morto o meno.

Sintassi

bool isPlayerDead ( player thePlayer )

Argomenti richiesti

  • thePlayer: Il player di cui vuoi verificare la morte.

Valori restituiti

Restituisce true se il player è morto, altrimenti false.

Esempio

Click to collapse [-]
Server

Questo esempio permette a un giocatore di usare il comando 'sonomorto' per verificare se sia morto o meno.

--Verifica se il giocatore è morto meno e mostra un messaggio nella chatbox
function verificaMorte ( thePlayer, commandName )
    if ( isPlayerDead ( thePlayer ) ) then
         outputChatBox ( "Sei morto, preparati a diventare uno zombie!", thePlayer )
    else
         outputChatBox ( "Tira pure un sospiro di sollievo, sei vivo.", thePlayer )
    end
end
addCommandHandler ( "sonomorto", verificaMorte )
Click to collapse [-]
Client

Questo esempio permette a un giocatore di usare il comando 'sonomorto' per verificare se sia morto o meno.

--Check if player is alive or dead and let them know in the chat box
function verificaMorte ( commandName )
    if ( isPlayerDead ( getLocalPlayer() ) ) then
         outputChatBox ( "Sei morto, preparati a diventare uno zombie!", getLocalPlayer() )
    else
         outputChatBox ( "Tira pure un sospiro di sollievo, sei vivo.", getLocalPlayer() )
    end
end
addCommandHandler ( "sonomorto", verificaMorte )

Vedere anche