#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
new Barret[MAX_PLAYERS];
new Text:BarretTD[MAX_PLAYERS];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Barret .50 Caliber by strier loaded.");
print("--------------------------------------\n");
for(new i = 0; i < MAX_PLAYERS; i++)
{
BarretTD[i] = TextDrawCreate(4.000000, 438.000000, " ");
TextDrawBackgroundColor(BarretTD[i], 255);
TextDrawFont(BarretTD[i], 2);
TextDrawLetterSize(BarretTD[i], 0.250000, 1.000000);
TextDrawColor(BarretTD[i], -1);
TextDrawSetOutline(BarretTD[i], 1);
TextDrawSetProportional(BarretTD[i], 1);
}
return 1;
}
public OnPlayerConnect(playerid)
{
Barret[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid)
{
Barret[playerid] = 0;
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(Barret[playerid] == 1)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 34)
{
new Float:px,Float:py,Float:pz, str[250], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(issuerid, target, sizeof(target));
SetPlayerHealth(playerid, 0.0);
GetPlayerPos(playerid, px, py, pz);
CreateExplosion(px,py,pz, 1, 2.0);
format(str, sizeof(str), "Player ~r~~h~%s ~w~has snipered ~r~~h~%s ~w~with caliber .50 barret!", pName, target);
TextDrawSetString(BarretTD[playerid], str);
TextDrawShowForAll(BarretTD[playerid]);
SetTimer("Updater", 15000, true);
}
}
return 1;
}
forward Updater();
public Updater()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
TextDrawHideForAll(BarretTD[i]);
}
return 1;
}
CMD:sniper(playerid, params[])
{
GivePlayerWeapon(playerid, 34, 500);
return 1;
}
CMD:enablebarret(playerid, params[])
{
Barret[playerid] = 1;
SendClientMessage(playerid, -1, "Barret enabled !");
return 1;
}
CMD:disablebarret(playerid, params[])
{
Barret[playerid] = 0;
SendClientMessage(playerid, -1, "Barret disabled !");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
Bueno, al momento que pongo /enablebarret me da todo bien, se supone que en ese momento la variable tiene que funcionar, pero al dispararle a otro jugador el pierde la health normal que pierde con un tiro de sniper, osea no se crea la explosion, ni el textdrawstring.. :/
|
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(Barret[issuerid] == 1)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 34)
{
new Float:px,Float:py,Float:pz, str[250], target[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(issuerid, target, sizeof(target));
SetPlayerHealth(playerid, 0.0);
GetPlayerPos(playerid, px, py, pz);
CreateExplosion(px,py,pz, 1, 2.0);
format(str, sizeof(str), "Player ~r~~h~%s ~w~has snipered ~r~~h~%s ~w~with caliber .50 barret!", pName, target);
TextDrawSetString(BarretTD[playerid], str);
TextDrawShowForAll(BarretTD[playerid]);
SetTimer("Updater", 15000, true);
}
}
return 1;
}