PDA

View Full Version : [Duv] OnPlayerUpdate


Krypton
11/01/2010, 07:19 PM
existe algum "sensor"(tipo onplayerdeath) que indentifique a mudança de vida para menor de um certo valor tipo "quem tiver a vida menor que 10 vai morrer"

OnPlayerHealth Existe?

speliarmos
11/01/2010, 07:28 PM
existe algum "sensor"(tipo onplayerdeath) que indentifique a mudança de vida para menor de um certo valor tipo "quem tiver a vida menor que 10 vai morrer"

OnPlayerHealth Existe?



Faça.
Eu usaria o OnPlayerUpdate


public OnPlayerUpdate(playerid)
{
new
str[128],
Nome[64];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(str, sizeof(str), "O jogador %s está morrendo!");
if(GetPlayerHealth(playerid) <= 10.0) return SendClientMessageToAll(COR, str);
return 1;
}

Krypton
11/01/2010, 07:32 PM
eu queria um bagulho quando a vida chega se a 10 ele desmaia e tinha que chamar o samu.

speliarmos
11/01/2010, 07:41 PM
eu queria um bagulho quando a vida chega se a 10 ele desmaia e tinha que chamar o samu.


public OnPlayerUpdate(playerid)
{
if(GetPlayerHealth(playerid) <= 10.0)
{
new
str[128],
Nome[64];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(str, sizeof(str), "O jogador %s está morrendo! SAMU vem busca o malaco!");
SendClientMessageToAll(COR, str);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 0, 1, 1, 1, 1);
TogglePlayerControllable(playerid, 0);
return 1;
}
return 1;
}

Ai coloca pra quando os carinha chegar digitar la o comando e no comando coloca TogglePlayerControllable(iddocara, 1);

Krypton
11/01/2010, 08:28 PM
acabei por montar um fs com o codigo mas esta dando error
voce pode corrigir para min?
edit:
ja sei oque e!!! qual e o include do OnPlayerUpdate?

FS
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <morphinc>
#include <cpstream>
#include <Y_Objects>
#define VERDE 0x33AA33AA

forward Morte(playerid);
forward Morte2(playerid);
forward Morte3(playerid);

public OnPlayerUpdate(playerid)
{
if(GetPlayerHealth(playerid) <= 10.0)
{
new
str[128],
Nome[64];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(str, sizeof(str), "O jogador %s está morrendo!Liguem Para o SAMU");
SendClientMessageToAll(VERDE, str);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 0, 1, 1, 1, 1);
TogglePlayerControllable(playerid, 0);
SetTimerEx("Morte",1*60000, false, "d", playerid);//
return 1;
}


public Morte(playerid);

{
SetPlayerHealth(playerid, 55.0)
SetTimerEx("Morte2",1*60000, false, "d", playerid);
return 1;
}


public Morte2(playerid);
{
GetPlayerHealth(playerid, 05.0)
SendClientMessage(playerid, VERDE, "O samu Demorou muito voce ésta em coma!");
SetPlayerPos(playerid,1939.5685,-2121.9780,-18.6666);
SetPlayerHealth(playerid,55.0);
TogglePlayerControllable(playerid,0);//Congela
SendClientMessage(playerid, VERDE, "Você Está em Coma!");
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
SetTimerEx("Morte3",1*60000, false, "d", playerid);
return 1;


}

public Morte3(playerid);
{
SendClientMessage(playerid, VERDE, "Você Acordou do Coma!");
SetPlayerPos(playerid,1176.8536,-1323.3251,14.0418);
TogglePlayerControllable(playerid,1);
return 1;
}
//CREDITOS:
//{
//[VGS]speliarmos_OC : me ajudou a fazer os scripts!!!!!!!!!
//Filter script montado por min : Krypton

ERRO
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(18) : warning 202: number of arguments does not match definition
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(33) : warning 217: loose indentation
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(33) : error 029: invalid expression, assumed zero
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(33) : error 004: function "Morte" is not implemented
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(37) : error 001: expected token: ";", but found "-identifier-"
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(42) : warning 225: unreachable code
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(42) : error 029: invalid expression, assumed zero
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(42) : error 004: function "Morte2" is not implemented
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(44) : error 035: argument type mismatch (argument 2)
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(57) : warning 225: unreachable code
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(57) : error 029: invalid expression, assumed zero
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(57) : error 004: function "Morte3" is not implemented
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(69) : error 030: compound statement not closed at the end of file (started at line 18)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


9 Errors.

Guilherme_Canani
11/01/2010, 08:35 PM
Krypton, use [ pawn ] ao invés de [ code ]
E coloque somente as linhas com erro e os erros

speliarmos
11/01/2010, 08:40 PM
acabei por montar um fs com o codigo mas esta dando error
voce pode corrigir para min?
edit:
ja sei oque e!!! qual e o include do OnPlayerUpdate?

FS
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <morphinc>
#include <cpstream>
#include <Y_Objects>
#define VERDE 0x33AA33AA

forward Morte(playerid);
forward Morte2(playerid);
forward Morte3(playerid);

public OnPlayerUpdate(playerid)
{
if(GetPlayerHealth(playerid) <= 10.0)
{
new
str[128],
Nome[64];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(str, sizeof(str), "O jogador %s está morrendo!Liguem Para o SAMU");
SendClientMessageToAll(VERDE, str);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 0, 1, 1, 1, 1);
TogglePlayerControllable(playerid, 0);
SetTimerEx("Morte",1*60000, false, "d", playerid);//
return 1;
}


public Morte(playerid);

{
SetPlayerHealth(playerid, 55.0)
SetTimerEx("Morte2",1*60000, false, "d", playerid);
return 1;
}


public Morte2(playerid);
{
GetPlayerHealth(playerid, 05.0)
SendClientMessage(playerid, VERDE, "O samu Demorou muito voce ésta em coma!");
SetPlayerPos(playerid,1939.5685,-2121.9780,-18.6666);
SetPlayerHealth(playerid,55.0);
TogglePlayerControllable(playerid,0);//Congela
SendClientMessage(playerid, VERDE, "Você Está em Coma!");
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 0, 0, 0, 0, 0);
SetTimerEx("Morte3",1*60000, false, "d", playerid);
return 1;


}

public Morte3(playerid);
{
SendClientMessage(playerid, VERDE, "Você Acordou do Coma!");
SetPlayerPos(playerid,1176.8536,-1323.3251,14.0418);
TogglePlayerControllable(playerid,1);
return 1;
}
//CREDITOS:
//{
//[VGS]speliarmos_OC : me ajudou a fazer os scripts!!!!!!!!!
//Filter script montado por min : Krypton

ERRO
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(18) : warning 202: number of arguments does not match definition
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(33) : warning 217: loose indentation
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(33) : error 029: invalid expression, assumed zero
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(33) : error 004: function "Morte" is not implemented
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(37) : error 001: expected token: ";", but found "-identifier-"
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(42) : warning 225: unreachable code
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(42) : error 029: invalid expression, assumed zero
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(42) : error 004: function "Morte2" is not implemented
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(44) : error 035: argument type mismatch (argument 2)
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(57) : warning 225: unreachable code
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(57) : error 029: invalid expression, assumed zero
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(57) : error 004: function "Morte3" is not implemented
C:\Users\Tadeu\Contacts\Desktop\samp server\filterscripts\10l.pwn(69) : error 030: compound statement not closed at the end of file (started at line 18)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


9 Errors.


OnPlayerUpdate ja é função do samp.

Krypton
11/01/2010, 10:06 PM
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <morphinc>
#include <cpstream>
#include <Y_Objects>
#define VERDE 0x33AA33AA
forward Coma(playerid);
forward hs(playerid);
public OnPlayerUpdate(playerid)
{

if(GetPlayerHealth(playerid) <= 20.0)
{
new str[128];
new Nome[64];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(str, sizeof(str), "O jogador %s está morrendo! Liguem para o Samu!!!");
SendClientMessageToAll(VERDE, str);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 0, 1, 1, 1, 1);
TogglePlayerControllable(playerid, 0);
SetTimerEx("Coma",2*15000, false, "d", playerid);
return 1;
}
}

public Coma(playerid)
{
new cut;
new string[256];
SetPlayerPos(playerid, 1939.5685,-2121.9780,-18.6666);
format(string, sizeof(string), "Hospital: Você Está em Coma.", cut);
SendClientMessage(playerid, VERDE, string);
SetTimerEx("hs",2*15000, false, "d", playerid);
return 1;
}

public hs(playerid)

{

SetPlayerHealth(playerid, 0.0);

return 1;

}



eu acabei de fazer nao tem erros e nao ta funcionando nao sei porque eu chego a menos de 10.0 de vida e nao acontece nada!

GhOsT[X]
12/01/2010, 07:43 PM
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <morphinc>
#include <cpstream>
#include <Y_Objects>
#define VERDE 0x33AA33AA
forward Coma(playerid);
forward hs(playerid);

public OnPlayerUpdate(playerid)
{
if(GetPlayerHealth(playerid) <= 20.0)
{
new str[128];
new Nome[64];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(str, sizeof(str), "O jogador %s está morrendo! Liguem para o Samu!!!");
SendClientMessageToAll(VERDE, str);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.1, 0, 1, 1, 1, 1);
TogglePlayerControllable(playerid, 0);
SetTimerEx("Coma",30000, false, "d", playerid);
return 1;
}
}

public Coma(playerid)
{
new cut;
new string[256];
SetPlayerPos(playerid, 1939.5685,-2121.9780,-18.6666);
format(string, sizeof(string), "Hospital: Você Está em Coma.", cut);
SendClientMessage(playerid, VERDE, string);
SetTimerEx("hs",30000, false, "d", playerid);
return 1;
}

public hs(playerid)
{
SetPlayerHealth(playerid, 0.0);
return 1;
}