16.12.2012, 17:35
Eu fiz essa fs simples e tals, sу que a blindagem so atualiza quando entrar ou sair do carro, tem que por em outra funзгo ? alguem sabe resolver ? os creditos pela ajuda vгo para o fs =-D
pawn Код:
#include <a_samp>
#define MaxVuln 100
#define COLOR_RED 0xAA3333AA
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new Text:Textdraw3;
new Text:Textdraw4;
new Text:Textdraw5;
new Vuln[MAX_VEHICLES];
public OnFilterScriptInit()
{
print("(Blindagem System FS By: gabrielloko157)");
print("(Blindagem System Carregado com sucesso!)");
// Create the textdraws:
Textdraw0 = TextDrawCreate(530.000000, 191.000000, ".");
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.119999, 25.500061);
TextDrawColor(Textdraw0, -16776961);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
Textdraw1 = TextDrawCreate(590.000000, 190.000000, ".");
TextDrawBackgroundColor(Textdraw1, 255);
TextDrawFont(Textdraw1, 1);
TextDrawLetterSize(Textdraw1, 0.119999, 25.600061);
TextDrawColor(Textdraw1, -16776961);
TextDrawSetOutline(Textdraw1, 0);
TextDrawSetProportional(Textdraw1, 1);
TextDrawSetShadow(Textdraw1, 1);
Textdraw2 = TextDrawCreate(533.000000, 338.000000, "Blindagem");
TextDrawBackgroundColor(Textdraw2, 255);
TextDrawFont(Textdraw2, 1);
TextDrawLetterSize(Textdraw2, 0.329999, 2.399999);
TextDrawColor(Textdraw2, 16711935);
TextDrawSetOutline(Textdraw2, 1);
TextDrawSetProportional(Textdraw2, 1);
Textdraw3 = TextDrawCreate(537.000000, 366.000000, "%d%");
TextDrawBackgroundColor(Textdraw3, 255);
TextDrawFont(Textdraw3, 1);
TextDrawLetterSize(Textdraw3, 0.559999, 1.800000);
TextDrawColor(Textdraw3, 16711935);
TextDrawSetOutline(Textdraw3, 1);
TextDrawSetProportional(Textdraw3, 1);
Textdraw4 = TextDrawCreate(527.000000, 336.000000, "i");
TextDrawBackgroundColor(Textdraw4, 255);
TextDrawFont(Textdraw4, 1);
TextDrawLetterSize(Textdraw4, 7.789994, 0.200000);
TextDrawColor(Textdraw4, -16776961);
TextDrawSetOutline(Textdraw4, 0);
TextDrawSetProportional(Textdraw4, 1);
TextDrawSetShadow(Textdraw4, 1);
Textdraw5 = TextDrawCreate(528.000000, 385.000000, "i");
TextDrawBackgroundColor(Textdraw5, 255);
TextDrawFont(Textdraw5, 1);
TextDrawLetterSize(Textdraw5, 7.789994, 0.200000);
TextDrawColor(Textdraw5, -16776961);
TextDrawSetOutline(Textdraw5, 0);
TextDrawSetProportional(Textdraw5, 1);
TextDrawSetShadow(Textdraw5, 1);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[]) {
if (strcmp(cmdtext, "/blindar", true) == 0) {
new vehicleid = GetPlayerVehicleID(playerid);
Vuln[vehicleid] = MaxVuln;
}
return 1;
}
public OnFilterScriptExit()
{
TextDrawHideForAll(Textdraw0);
TextDrawDestroy(Textdraw0);
TextDrawHideForAll(Textdraw1);
TextDrawDestroy(Textdraw1);
TextDrawHideForAll(Textdraw2);
TextDrawDestroy(Textdraw2);
TextDrawHideForAll(Textdraw3);
TextDrawDestroy(Textdraw3);
TextDrawHideForAll(Textdraw4);
TextDrawDestroy(Textdraw4);
TextDrawHideForAll(Textdraw5);
TextDrawDestroy(Textdraw5);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new blindagem[41];
format(blindagem, sizeof(blindagem), "%d%",Vuln[vehicleid]);
TextDrawSetString(Textdraw3, blindagem);
TextDrawShowForPlayer(vehicleid, Textdraw3);
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw1);
TextDrawShowForPlayer(playerid, Textdraw2);
TextDrawShowForPlayer(playerid, Textdraw3);
TextDrawShowForPlayer(playerid, Textdraw4);
TextDrawShowForPlayer(playerid, Textdraw5);
}
else if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
{
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
TextDrawHideForPlayer(playerid, Textdraw2);
TextDrawHideForPlayer(playerid, Textdraw3);
TextDrawHideForPlayer(playerid, Textdraw4);
TextDrawHideForPlayer(playerid, Textdraw5);
}
return 0;
}
public OnVehicleDamageStatusUpdate(vehicleid, playerid) {
if(Vuln[vehicleid] > 0) {
Vuln[vehicleid]--;
RepairVehicle(vehicleid);
}
return true;
}