Код:
#define FILTERSCRIPT
#include <a_samp>
#define TireDano(%1,%2,%3,%4) %1 | (%2 << 1) | (%3 << 2) | (%4 << 3)
forward Pneu(playerid);
new
Tapete,
Angle,
Float:xx,
Float:yy,
Float:zz;
new PlayerTap[MAX_PLAYERS] = 0;
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
new connect_timer[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
print("Iniciando Timer...");
connect_timer[playerid] = SetTimerEx("WelcomeTimer", 5000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
if(PlayerTap[playerid] == 1)
{
DestroyObject(Tapete);
}
KillTimer(Pneu(playerid));
PlayerTap[playerid] = 0;
return 1;
}
public OnGameModeInit()
{
if(GetMaxPlayers() > MAX_PLAYERS)
{
SendRconCommand("Servidor Fechado - Volte Depois!");
SendRconCommand("password 123321456654");
printf("[ERROR]: 'maxplayers' (%i) exceeds MAX_PLAYERS (%i). Please fix this.", GetMaxPlayers(), MAX_PLAYERS);
}
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
public OnFilterScriptInit()
{
SetTimer("Pneu",120,1);
return 1;
}
public Pneu(playerid)
{
new Dano[4];
if (IsPlayerInAnyVehicle(playerid))
{
if (PlayerToPoint(5.0, playerid,xx,yy,zz))
{
GetVehicleDamageStatus(GetPlayerVehicleID(playerid), Dano[0], Dano[1], Dano[2], Dano[3]);
UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), Dano[0], Dano[1], Dano[2], TireDano(1, 1, 1, 1));
}
}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tapete", cmdtext, true, 10) == 0)
{
if(PlayerTap[playerid] == 0)
{
GetPlayerPos(playerid,xx,yy,zz);
Tapete = CreateObject(2899, xx, yy, zz-0.9, 0, 0, Angle-90);
PlayerTap[playerid] = 1;
return 1;
}
else
{
SendClientMessage(playerid, -1, "Vocк jб colocou um Tapete De Pregos.");
return 1;
}
}
if (strcmp("/deletartapete", cmdtext, true, 10) == 0)
{
if(PlayerTap[playerid] == 1)
{
DestroyObject(Tapete);
KillTimer(Pneu(playerid));
PlayerTap[playerid] = 0;
return 1;
}
else
{
SendClientMessage(playerid, -1, "Vocк nгo colocou um Tapete De Pregos.");
return 1;
}
}
return 0;
}