12.11.2018, 10:48
Olб, meu povo. Tф escrevendo um comando estilo /heal [ID] mas nгo tenho experiкncia com programaзгo. Atй agora tб funcionando direitinho, mas nгo consigo colocar um tempo para esperar atй poder usar o comando novamente. Nenhum dos tutoriais e tуpicos com pessoas pedindo a mesma coisa deu certo aqui.
Eis o meu cуdigo:
Se ainda ficou difнcil para alguйm entender, eu quero que o player realize o comando e tenha que esperar 1 minuto para conseguir fazer de novo.
Obrigado
Eis o meu cуdigo:
Код:
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;
}
}
}
Obrigado


