06.09.2012, 16:21
Hi, I have a problem. I want to do something when player damage vehicle. For test I want to SetPlayerMessage.
Top in my script:
public OnGameModeInit:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger):
Down in my script:
It show message only when I get in/out vehicle. But I want to show when I damage a vehicle.
Sorry for my bad english. ; <
Top in my script:
Код:
new Float:dhp[MAX_PLAYERS];
Код:
SetTimer("DamageUpdate", 1000, true);
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new vehiclepid; vehiclepid = GetPlayerVehicleID(playerid); dhp[playerid] = GetVehicleHealth(vehiclepid, dhp[playerid]); return 1; }
Код:
forward DamageUpdate(playerid); public DamageUpdate(playerid) { new vehicleid; vehicleid = GetPlayerVehicleID(playerid); new Float:nhp; nhp = GetVehicleHealth(vehicleid, nhp); if(nhp != dhp[playerid]) SendClientMessage(playerid,-1,"{FFFFFF}Damage"), dhp[playerid] = nhp; }
Sorry for my bad english. ; <