onplayerweapon shot car? -
StR_MaRy - 14.11.2016
hey guys is possible to check if the shoted car is the good one or not ?
Код HTML:
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
if(MissionCar[4])
{
Step = 0;
MisiuneActiva = 0;
DestroyActor(Actorr[0]);
DestroyActor(Actorr[1]);
OwnerMisiune[playerid] = 0;
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/ppuz6duc8e/Mission_Passed.mp3");
SendClientMessage(playerid, -1, "Ai distrus servieta cu bani, acum nu isi mai pot incheia afacerea ilegala.");
GameTextForPlayer(playerid, "~y~mission passed!", 5000, 3);
}
else return SendClientMessage(playerid, -1, "Nu aia este masina ce trebuie distrusa.");
}
Re: onplayerweapon shot car? -
IceBilizard - 14.11.2016
Can you explain more please what you mean with car is good one or not?
Re: onplayerweapon shot car? -
Awide - 14.11.2016
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == 2)
{
new bool: isany_incar = false;
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(IsPlayerInVehicle(i, hitid))
{
isany_incar = true;
break;
}
}
if(isany_incar != true)//You hit a vehicle with noone sitting inside.
{
//the vehicle's ID you've hit is hitid
new Float:vHealth;
GetVehicleHealth(hitid, vHealth);
SetVehicleHealth(hitid, vHhealth - 50);
}
}
return 1;
}
I hope this helps. If you need more details or an explanation somewhere just tell me, should be clear as you read the code with the comments.
Re: onplayerweapon shot car? -
StR_MaRy - 14.11.2016
yea so i want to shot a car with no one inside only that car called MissionCar[4] and if he didn't hit that car called MissionCar[4] he will get a message like "that car you shot is the wrong one"
Re: onplayerweapon shot car? -
Awide - 14.11.2016
Then compare the vehicle ID he hit with the mission car, if they don't match make the script send that message.
Re: onplayerweapon shot car? -
StR_MaRy - 14.11.2016
that is the problem i don't know how...
Re: onplayerweapon shot car? -
Awide - 14.11.2016
Код:
if(hitid != MissionCar[4])
SendClientMessage(playerid, color, "that car you shot is the wrong one");
Try to use this together the way I showed. Let's see if you get somewhere, come back if you couldn't make it. :P
Re: onplayerweapon shot car? -
IceBilizard - 14.11.2016
Try this
PHP код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
new vehicleid = hitid;
if(vehicleid == MissionCar[4])
{
SendClientMessage(playerid, -1, "You've hitted correct car");
}
else
{
SendClientMessage(playerid, -1, "You've hitted wrong car");
}
}
return 1;
}
Re: onplayerweapon shot car? -
StR_MaRy - 14.11.2016
thx all of you , corect script IceBilizard
Re: onplayerweapon shot car? -
SickAttack - 14.11.2016
Quote:
Originally Posted by IceBilizard
Try this
PHP код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
new vehicleid = hitid;
if(vehicleid == MissionCar[4])
{
SendClientMessage(playerid, -1, "You've hitted correct car");
}
else
{
SendClientMessage(playerid, -1, "You've hitted wrong car");
}
}
return 1;
}
|
hitted isn't a word...
There's no need to create a variable, just use
hitid.