[Tutorial] Hospital System Tutorial.
#1




Irei mostrar a vocкs como criar um basico sistema de hospital, como varios servers rpg usam uns bugados, irei disponibilizar meu tutorial de como criar um.

Descriзгo: Sistema basico, serve tanto para servidores de DeathMatch ou RolePlaying
Detalhes: Irei explicar detalhe por detalhe
pawn Код:
new Hospital[MAX_PLAYERS];
new Hospital[MAX_PLAYERS]; Essa varial vai ser usada para fazer o sistema.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    Hospital[playerid] = 1;
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason) Public de quando a pessoa morre.
{ Abre a chave
Hospital[playerid] = 1; Usamos a varial que definimos no topo, setamos Hospital para 1
return 1; Retorna a 1
} Fecha a chave
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(Hospital[playerid] == 1)
    {
        SetPlayerPos(playerid, X,Y,Z);
        TogglePlayerControllable(playerid, false);
        SetTimerEx("Curando", 5000, false, "i", playerid);
        SendClientMessage(playerid, 0xFF3030FF,"[Hospital] Vocк estб sendo curado.");
        // Vocк pode acrescentar mais coisas ao seu gosto.
    }
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate) Public que usamos para fazer o sistema, ela checa tudo se hospital й igual a 1 ou igual a 0.
{ Abre a chave
if(Hospital[playerid] == 1) Verifica se Hospital й igual a 1
{ Abre outra Chave
SetPlayerPos(playerid, X,Y,Z); Seta o player para uma coordenada. Troque X Y Z pela coordenada que vocк queira.
TogglePlayerControllable(playerid, false); Congela o player, True Descongela False congela
SetTimerEx("Curando", 5000, false, "i", playerid); Timer de 5000 = 5 segundos, False = Nгo vai chamar a timer novamente so vai ser executada quando tiver com hospital igual a 1.
SendClientMessage(playerid, 0xFF3030FF,"[Hospital] Vocк estб sendo curado.");
Manda a mensagem para o player, 0xFF3030FF й a cor, [Hospital] Vocк estб sendo curado. й a mensagem que manda.
} fecha a primeira chave
return 1; retorna a 1
}
fecha a segunda chave aberta.
pawn Код:
forward Curando(playerid);
public Curando(playerid)
{
    TogglePlayerControllable(playerid, true);
    Hospital[playerid] = 0;
    SetPlayerPos(playerid, X,Y,Z);
    GivePlayerMoney(playerid, -200);
    SendClientMessage(playerid, 0xFF3030FF,"[Hospital] Medico KidBengala le curou, preзo: 200");
}
forward Curando(playerid); Define a callback Curando ( Usada no timer )
public Curando(playerid) Callback jб definida, quando estб com hospital igual a 1, ela й chamada
{ Abre a Chave
TogglePlayerControllable(playerid, true); Como expliquei la em cima, True descongela e False Congela
Hospital[playerid] = 0; Seta a varial Hospital a 0
SetPlayerPos(playerid, X,Y,Z); Seta o player para uma coordenada. Troque X Y Z pela coordenada que vocк queira.
GivePlayerMoney(playerid, -200); Tira 200 reais do player.
SendClientMessage(playerid, 0xFF3030FF,"[Hospital] Medico KidBengala le curou, preзo: 200"); Manda a mensagem, 0xFF3030FF й a cor, [Hospital] Medico KidBengala le curou, preзo: 200 й a mensagem
} Fecha a chave
Caso estiver algo errado me avise. obg

Creditos: Lipe_Stronda
Reply


Messages In This Thread
Hospital System Tutorial. - by Lipe_Stronda - 12.10.2011, 20:38
Re: Hospital System Tutorial. - by [O.z]Caroline - 12.10.2011, 20:42
Re: Hospital System Tutorial. - by Lipe_Stronda - 12.10.2011, 20:49
Re: Hospital System Tutorial. - by [O.z]Caroline - 12.10.2011, 20:53
Re: Hospital System Tutorial. - by Lipe_Stronda - 12.10.2011, 20:55
Re: Hospital System Tutorial. - by Liba.Nakajima - 12.10.2011, 21:02
Re: Hospital System Tutorial. - by Dolby - 12.10.2011, 21:02
Re: Hospital System Tutorial. - by [O.z]Caroline - 12.10.2011, 21:05
Re: Hospital System Tutorial. - by Lipe_Stronda - 12.10.2011, 21:13
Re: Hospital System Tutorial. - by Shelby - 12.10.2011, 21:18

Forum Jump:


Users browsing this thread: 2 Guest(s)