02.07.2016, 05:39
Й possнvel fazer, pra que quando o player que estб com o escudo, й atingido, nгo perder life? Se caso acertem no escudo, como nesse vнdeo: https://www.youtube.com/watch?v=CwOQoIPSqvc
new escudo[MAX_PLAYERS]; //topo
public OnPlayerConnect(playerid)
{
Escudo[playerid] = 0;
return 1;
}
//no public OnPlayerCommandText
if(strcmp(cmd, "/escudo", true) == 0)
{
if(Escudo[playerid] == 0)
{
SetPlayerAttachedObject(playerid,3,18637,13,0.35,0.0,0.0,0.0,0.0,180.0);
SendClientMessage(playerid, -1 "Vocк colocou seu escudo.");
Escudo[playerid] = 1;
return 1;
}
else if(Escudo[playerid] == 1)
{
RemovePlayerAttachedObject(playerid,3);
Escudo[playerid] = 0;
SendClientMessage(playerid, -1 "Vocк retirou seu escudo.");
return 1;
}
}
public OnPlayerSpawn(playerid)
{
if(Escudo[playerid] == 1) SetTimerEx("CarregarItem", 2000, false, "i", playerid);
return 1;
}
forward CarregarItem(playerid);
public CarregarItem(playerid)
{
SetPlayerAttachedObject(playerid,3,18637,13,0.35,0.0,0.0,0.0,0.0,180.0);
SendClientMessage(playerid, -1, "Item carregado.");
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
new Float:Vida,Float:Colete;
GetPlayerArmour(playerid,Colete);
GetPlayerHealth(playerid, Vida);
//bloquear dano
if(issuerid != INVALID_PLAYER_ID && Escudo[playerid] == 1)
{
if(Colete >= 1)
{
SetPlayerArmour(playerid, Colete - 0);
}
else
{
SetPlayerHealth(playerid, Vida - 0);
}
return 1;
}
return 1;
}
Em programaзгo nada й impossнvel, a ъnica coisa que te limita й voce mesmo! Como uma inteligкncia artificial, o difнcil nгo й programa-la ,mas fazer que o seu algoritmo entenda o sentido denotativo e conotativo ,e as vezes voce programa certo mas com um algoritmo errado, espere por nos!
|