14.10.2018, 21:30
Usa isso como base, estou fazendo com pressa entao nao pensa que vai sair grande coisa!
fiz com pressa ai, desculpa se tem algum erro, mas use esse como base!
Ajudei? ++ rep
PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf>
new PedindoAjuda[MAX_PLAYERS];
new Medico[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
PedindoAjuda[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PedindoAjuda[playerid] = 0;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:Pos[4], string[110], aname[MAX_PLAYER_NAME];
GetPlayerPos(playerid, Pos[1], Pos[2], Pos[3]); // pega a posiзгo dele!
SetPlayerPos(playerid, Pos[1], Pos[2], Pos[3]); // seta a posiзгo dele
ApplyAnimation(playerid, "PED", "WALK_DRUNK", 4.1, 1, 1, 1, 1, 1, 1); // aqui vc coloca a animaзгo que vc quer!
PedindoAjuda[playerid] = 1; // seta que ele esta pedindo ajuda!
GetPlayerName(playerid, aname, sizeof(aname));
format(string, sizeof(string), "[ x ]O player %s esta pedindo ajuda pois esta morto!", aname); // formata a mensagem para o player!
for(new i; i < GetPlayerPoolSize(); i++) // loop para ver os player on!
{
if(Medico[i] == 1) // se o player for medico
{
SendClientMessage(i, -1, string); // manda a string pra quem e medico
SetPlayerCheckpoint(i, 3.0, Pos[1], Pos[2], Pos[3]);
}
}
return 1;
}
CMD:ajudaplayer(playerid, params[])
{
new id, Float:Pos2[4];
if(Medico[playerid] == 1) // checa se ele e medico!
{
if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "ERRO. Use: /ajudaplayer [ id ]!"); // ve se os parametros do comando ta ok
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000AA, "[ erro ]Esse player nao ta on!"); // se ele n ta on retorna erro
if(PedindoAjuda[id] == 0) return SendClientMessage(playerid, 0xFF00000AA, "[ ERRO ]esse player nao ta pedindo ajuda!"); // checa se ele quer ajuda
GetPlayerPos(id, Pos2[1], Pos2[2], Pos2[3]); //pega a posiзгo do id!
if(IsPlayerInRangeOfPoint(playerid, 3.0, Pos2[1], Pos2[2], Pos2[3])) // se o medico ta a 3 metros de distancia dele!
{
if(GetPlayerMoney(id) > 100) // checa se o player tem money!
{
GivePlayerMoney(id, -100); // tira a money dele
SetPlayerHealth(id, 100); // seta vida nele
PedindoAjuda[id] = 0; // seta que ele nao quer mais ajuda!
ClearAnimations(id);
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "[ ERRO ]Esse player nao tem dinheiro o suficiente!"); // se ele n tiver dinheiro
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "[ ERRO ]Vocк nгo ta perto desse player!");
}
}
return 1;
}
Ajudei? ++ rep