27.09.2014, 13:11
I have an important question, how do I do that you can hit a particular object, for example if you beat it 20 times last player that beat him gets the money?
Thanks to helpers.
Thanks to helpers.
public OnPlayerShootObject(playerid, objectid)//just a example
{
Hitwinner = playerid;
return 1;
}
Create a stock for detecting if a player hitted the specific objectid and use a global variable Hitwinner.
Something like pawn Код:
|
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new Hits, Hitwinner;
if(hittype == BULLET_HIT_TYPE_OBJECT)
{
if(hitid == Objectid)//if he hitted the objectid, don't put the id here, use something like new Objectid; and use Objectid = CreateDynamic........ while creating object.
{
Hits++
Hitwinner = playerid;
If(Hits == 20)
{
GivePlayerMoney(Hitwinner, 1000);
Hits=0;
}
}
}
return 1;
}