CMD:medkit(playerid, params[])
{
new targetid;
if(class[playerid]!=0)
return SendClientMessage(playerid,COLOR_RED,"[ You must to be ASSAULT to heal players. ]");
if(sscanf(params, "u", targetid))
return SendClientMessage(playerid, COLOR_RED, "Syntax: /medkit [id]"); // syntax
if(targetid == INVALID_PLAYER_ID)
return SendClientMessage(playerid, COLOR_RED, "That player is not connected to the server!"); // valid id
else if(targetid == playerid)
{
SendClientMessage(playerid, COLOR_BLUE, "You healed youself!");
SetPlayerHealth(playerid,100); // yourself
return 1;
}
else if(GetDistanceBetweenPlayers(playerid, targetid) > 5.00)
return SendClientMessage(playerid, COLOR_RED, "That player is too far away!"); // in order to check if they are closely
else
{
new Float:hp;
GetPlayerHealth(targetid,hp);
if(hp>=100) return SendClientMessage(playerid,COLOR_RED,"[ The player has full health. ]");
else
{
SetPlayerHealth(targetid,100);
SendClientMessage(playerid,COLOR_BLUE,"[ You healed the player. ]");
SendClientMessage(targetid,COLOR_BLUE,"[ An ASSAULT player has healed you. ]");
return 1;
}
}
}
|
Pois й, meu brother. Se puder dar uma ajuda ai sobre como fazer isso. Tudo o que eu fiz deu erro. :/
Enquanto isso vou dar uma olhada nos tutoriais de GetTime. |
if(gettime() - TempoComando[playerid] < 20) return SendClientMessage(playerid, 0xFF0000FF, "Vocк tem que esperar 20 segundos para poder usar o comando novamente !");
TempoComando[playerid] = gettime();
new tempoComando[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
tempoComando[playerid] = 0;
return 1;
}
tempoComando[playerid] = gettime() + 60;
if(tempoComando[playerid] > gettime()) return SendClientMessage(playerid, -1, "Espere 60 segundos para enviar o comando novamente.");