21.04.2014, 14:04
How to set all sandkings max heal 150... i mean when the sandking gets spawn he will start with 150% HP
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
if(GetVehicleModel(vehicleid) == 495) // 411 is the Infernus model
{
SetVehicleHealth(vehicleid, 150);
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to FREE sandking!");
}
return 1;
}
pawn Код:
|
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(GetVehicleModel(vehicleid) == 495) // 495 is the SK model
{
DestroyVehicle(vehicleid);
SendClientMessage(playerid, 0xFF0000FF, "kwniwciwhwjnwni");
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
if(GetVehicleModel(vehicleid) == 495) // Check if vehicle is Sandking
{
SetVehicleHealth(vehicleid, 150); // Set the vehicle health to 150
}
return 1;
}
Nice... works but it's works after the car exploded... i mean only after he spawned... when Game Mode loaded it's not respawning the cars... just make them... how can i respawn all the cars when GameModeInit
|
// Putting this in OnGameModeExit or OnFilterScriptExit (if it's a filterscript)
for(new i = 0; i != MAX_VEHICLES; i++)
{
// Destroy all the vehicles
DestroyVehicle(i);
}
// Sets every Sandking health to 150.
// You have to put this to OnGameModeInit after the vehicle spawn codes
for(new i = 0; i != MAX_VEHICLES; i++)
{
if(GetVehicleModel(i) == 495)
{
SetVehicleHealth(i, 150.0);
}
}
stock HF_CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay)
{
if (modelid == 495) SetVehicleHealth(CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay), 150);
else CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay);
return 1;
}
#if defined _ALS_CreateVehicle
#undef CreateVehicle
#else
#define _ALS_CreateVehicle
#endif
#define CreateVehicle HF_CreateVehicle
public OnVehicleSpawn(vehicleid)
{
if (GetVehicleModel(vehicleid) == 495) SetVehicleHealth(vehicleid, 150);
return 1;
}
If I'm not wrong, if you're using CreateVehicle/AddStaticVehicle in OnGameModeInit, the vehicles will spawn normally. Just remove them while the server exits or restarts.
pawn Код:
|