18.02.2014, 23:55
Bom, no meu code pra usar a habilidade screamer tem um tempo, apos usa-la tem q esperar 4 segundos pra usa-la novamente, ai eu tentei fazer a mesma coisa, peguei esse codigo que bota 4 segundos de intervalo para o cara nгo abusar na habilidade de dropar item, sу quero saber se fiz certo, se vai funcionar, etc:
Base do code q eu peguei:
pawn Code:
if(PInfo[playerid][SPerk] == 9)
{
if(GetTickCount() - PInfo[playerid][Canscream] < 4000) return 0;
if(Team[playerid] == ZOMBIE) return 0;
if(PInfo[playerid][ZombieBait] == 1) return 0;
static string[70];
PInfo[playerid][ZombieBait] = 1;
format(string,sizeof string,""cjam"%s(%i) dropou uma Isca de Zumbi",GetPName(playerid),playerid);
SendNearMessage(playerid,white,string,20);
GetPlayerPos(playerid,PInfo[playerid][ZX],PInfo[playerid][ZY],PInfo[playerid][ZZ]);
PInfo[playerid][ZObject] = CreateObject(2908,PInfo[playerid][ZX],PInfo[playerid][ZY],PInfo[playerid][ZZ]-1,0,0,0,90);
SetTimerEx("StopBait",5000,false,"i",playerid);
}
Base do code q eu peguei:
pawn Code:
if(PInfo[playerid][ZPerk] == 8)
{
if(GetTickCount() - PInfo[playerid][Canscream] < 4000) return 0;
for(new i, f = MAX_PLAYERS; i < f; i++)
{
if(i == playerid) continue;
if(PInfo[i][Dead] == 1) continue;
if(Team[i] == ZOMBIE) continue;
if(IsPlayerInAnyVehicle(i)) continue;
static Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
if(IsPlayerInRangeOfPoint(i,20,x,y,z))
{
if(IsPlayerFacingPlayer(playerid, i, 70))
{
new Float:a;
GetPlayerVelocity(i,x,y,z);
GetPlayerFacingAngle(playerid,a);
x += ( 0.5 * floatsin( -a, degrees ) );
y += ( 0.5 * floatcos( -a, degrees ) );
SetPlayerVelocity(i,x,y,z+0.15);
}
}
static Float:Health;
GetPlayerHealth(i,Health);
MakeHealthEven(i,Health);
if(Health <= 10)
MakeProperDamage(i);
else
SetPlayerHealth(i,Health-4);
MakeHealthEven(i,Health);
GetPlayerHealth(i,Health);
if(Health <= 5)
{
GetPlayerPos(i,SpawnZX[i],SpawnZY[i],SpawnZZ[i]);
InfectPlayer(i);
GivePlayerXP(playerid);
CheckRankup(playerid);
}
if(PInfo[i][Infected] == 0) PInfo[i][Infected] = 1;
}
ApplyAnimation(playerid,"RIOT","RIOT_shout",3,1,1,1,1,1000,1);
SetTimerEx("ClearAnim2",700,false,"i",playerid);
PInfo[playerid][Canscream] = GetTickCount();
}