Jump to content
  • 0

cum fac o masina indestructibila?


Andr3y

Question

11 answers to this question

Recommended Posts

Guest farse

cu un timer..

La OnGameModeInit:

SetTimerEx("AutoRepair",1000,1);

Inainte de OnGameModeInit:

forward AutoRepair();
public AutoRepair()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i))continue;
if(GetPlayerState(i)==2)
{
new Float:HP;GetVehicleHealth(GetPlayerVehicleID(i),HP);
if(HP<600)SetVehicleHealth(GetPlayerVehicleID(i),1000);
}
}
}

Link to comment
Share on other sites

public OnGameModeInit()

SetTimer("AutoR", 1000, 1);//la OnGameModeInt

il pui in gm jos nu intrun public

forward AutoR();
public AutoR()
{
    for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
	{
 		if(IsPlayerConnected(playerid))
		{
			new Float:health, cid;
			if (IsPlayerInAnyVehicle(playerid))
			{
				cid = GetPlayerVehicleID(playerid);
 				GetVehicleHealth(cid, health);
  				if (health < 400)
				{
					RepairVehicle(cid);
					GameTextForPlayer(playerid, "Vehicle repaired!",2000,5);
				}
 			}
   		}
	}
	return 1;
}

Link to comment
Share on other sites

pai doar pui la aia de ex a lui farse:

forward AutoRepair();
public AutoRepair()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i))continue;
if(GetPlayerState(i)==2)
{
new Float:HP;GetVehicleHealth(GetPlayerVehicleID(i),HP);
if(HP<600)SetVehicleHealth(id-ul vehiculului,1000);
}
}
}

Fara reclama in semnatura!

Link to comment
Share on other sites

LaZ" post="78167" timestamp="1308480826"]

Eu as folosi callbackul OnVehicleDamageStatusUpdate.

http://wiki.sa-mp.com/wiki/OnVehicleDamageStatusUpdate

Atunci:

public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    if( vehicleid == ID_VEHICUL ) RepairVehicle( ID_VEHICUL );
    return 1;
}

Link to comment
Share on other sites

Guest farse

cea a lui Laz.

public OnVehicleDamageStatusUpdate(vehicleid, playerid)

{

    RepairVehicle(vehicleid);

    SetVehicleHealth(vehicleid,1000);

    return 1;

}

Link to comment
Share on other sites

cea a lui Laz.

public OnVehicleDamageStatusUpdate(vehicleid, playerid)

{

    RepairVehicle(vehicleid);

    SetVehicleHealth(vehicleid,1000);

    return 1;

}

RepairVehicle seteaza automat viata masinii la 1000, plus o repara si vizual, deci SetVehicleHealth - 1000 nu-si are rostul, deci asa e cel mai bine:

public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    if( vehicleid == ID_VEHICUL ) RepairVehicle( ID_VEHICUL );
    return 1;
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.