Автор : [SKRIPTER]
Ко всем define:
Ко всем define:
- Код:
#define TAZE_WEAPON 23
#define TAZE_TIMER 8000
#define TAZE_SPARK 18717
#define TAZE_DESTROY 1250
#define TAZE_LOSEHP 1
#define COLOR_PURPLE 0xC2A2DAAA // цвет тайзера
- Код:
new Tazer[MAX_PLAYERS];
new Spark[MAX_PLAYERS];
new Tazed[MAX_PLAYERS];
- Код:
forward DestroySpark(playerid);
forward Gamburger(playerid);//Таймер бургера
forward TazedRemove(playerid);
- Код:
Tazed[playerid] = 0;
Tazer[playerid] = 0;
- Код:
public DestroySpark(playerid)
{
DestroyObject(Spark[playerid]);
return 1;
}
public TazedRemove(playerid)
{
TogglePlayerControllable(playerid, 1);
ClearAnimations(playerid);
Tazed[playerid] = 0;
return 1;
}
- Код:
if(Tazer[playerid] == 1 && GetPlayerWeapon(playerid) == TAZE_WEAPON)
{
new Float:health,losehp;
GetPlayerHealth(damagedid,health);
losehp = TAZE_LOSEHP;
if(Tazed[damagedid] == 1) return 1;
new Float:x, Float:y, Float:z;
GetPlayerPos(damagedid, x, y, z);
ClearAnimations(damagedid);
ApplyAnimation(damagedid,"PED","KO_skid_front",4.1,0,1,1,1,0);
Spark[damagedid] = CreateObject(TAZE_SPARK, x, y, z-3, 0, 0, 0);
SetTimerEx("DestroySpark", TAZE_DESTROY, 0, "i", damagedid);
SetTimerEx("TazedRemove", TAZE_TIMER, 0, "i", damagedid);
//TogglePlayerControllable(damagedid, 0);
Tazed[damagedid] = 1;
if(losehp) {} else SetPlayerHealth(damagedid, health+amount);
}
- Код:
if (strcmp("/tazer", cmdtext, true, 6) == 0)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
if(Tazer[playerid] == 0)
{
if(GetPlayerWeapon(playerid) == TAZE_WEAPON) {} else return SendClientMessage(playerid, 0xFFFFFFFF, "{d4d4d4}У вас нету шокера");
Tazer[playerid] = 1;
format(string, sizeof(string), "%s активировал шокер", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
ApplyAnimation(playerid,"COLT45","colt45_reload",4.1,0,1, 1,1,1);
return 1;
}
else if(Tazer[playerid] == 1)
{
Tazer[playerid] = 0;
format(string, sizeof(string), "%s деактивировал шокер", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("Gamburger", 5000, false, "i", playerid);
ApplyAnimation(playerid,"COLT45","colt45_reload",4.1,1,1,1,1,1,1);
return 1;
}
else Tazer[playerid] = 0;
return 1;
}
- Код:
stock ProxDetector(Float:radi, playerid, string[],col1,col2,col3)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
}
}
}
}
return true;
}
- Код:
forward ClearAnim(playerid);
public ClearAnim(playerid)
{
ClearAnimations(playerid);
return 1;
}
public Gamburger(playerid) return ClearAnimations(playerid);