is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
[EDT]AmanSingh123 - 26.08.2011
Hi,
just wanted to know that is it possible to set a player health to 0 if he shoots from a deathmatch vehicle such as a rhino or hydra or hunter?
and if he does shoot it says a on screen messege that "you have been killed for shooting from a DM vehicle"
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
Kingunit - 26.08.2011
Yes that's possible I think so. Can you write down all those vehicles that you call 'DM' vehicles?
Maybe that's abit helping for us
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
[EDT]AmanSingh123 - 26.08.2011
Quote:
Originally Posted by Kingunit
Yes that's possible I think so. Can you write down all those vehicles that you call 'DM' vehicles?
Maybe that's abit helping for us 
|
Rhino, hunter and hydra..
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
[EDT]AmanSingh123 - 26.08.2011
oo forgot to say rc plane that shoots and that other helecopter, the splinter, something like that lol, well bassicly all vehicles that can shoot and kill players..
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
Pinguinn - 26.08.2011
Add this at OnPlayerEnterVehicle [until someone knows how to define 'vehicleid' at OnPlayerKeyStateChange
pawn Код:
SetPVarInt(playerid, "vehicleID", vehicleid);
If you are wondering why I am using 2 "if"s. The hydra has a flare and a shoot system. Flare is not a dm thing, and
because Flare = KEY_FIRE, you have to add a new "if" to check if he only pressed KEY_SECONDARY_ATTACK
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{
if((newkeys & KEY_FIRE || newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_FIRE || oldkeys & KEY_SECONDARY_ATTACK))
{
switch(GetPVarInt(playerid, "vehicleID"))
{
case 425, 432, 464, 476:
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, -1, "You have been killed because you dmed");
}
}
}
else if((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
{
switch(GetPVarInt(playerid, "vehicleID"))
{
case 520:
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, -1, "You have been killed because you dmed");
}
}
}
}
return 1;
}
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
[EDT]AmanSingh123 - 26.08.2011
Quote:
Originally Posted by Pinguinn
Add this at OnPlayerEnterVehicle [until someone knows how to define 'vehicleid' at OnPlayerKeyStateChange
pawn Код:
SetPVarInt(playerid, "vehicleID", vehicleid);
If you are wondering why I am using 2 "if"s. The hydra has a flare and a shoot system. Flare is not a dm thing, and
because Flare = KEY_FIRE, you have to add a new "if" to check if he only pressed KEY_SECONDARY_ATTACK
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(IsPlayerInAnyVehicle(playerid)) { if((newkeys & KEY_FIRE || newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_FIRE || oldkeys & KEY_SECONDARY_ATTACK)) { switch(GetPVarInt(playerid, "vehicleID")) { case 425, 432, 464, 476: { SetPlayerHealth(playerid, 0); SendClientMessage(playerid, -1, "You have been killed because you dmed"); } } } else if((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK)) { switch(GetPVarInt(playerid, "vehicleID")) { case 520: { SetPlayerHealth(playerid, 0); SendClientMessage(playerid, -1, "You have been killed because you dmed"); } } } } return 1; }
|
ill add this to my script and add the Vehicle ID and test it and ill reply back if it works.
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
Kaperstone - 26.08.2011
Quote:
Originally Posted by Pinguinn
Add this at OnPlayerEnterVehicle [until someone knows how to define 'vehicleid' at OnPlayerKeyStateChange
pawn Код:
SetPVarInt(playerid, "vehicleID", vehicleid);
If you are wondering why I am using 2 "if"s. The hydra has a flare and a shoot system. Flare is not a dm thing, and
because Flare = KEY_FIRE, you have to add a new "if" to check if he only pressed KEY_SECONDARY_ATTACK
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(IsPlayerInAnyVehicle(playerid)) { if((newkeys & KEY_FIRE || newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_FIRE || oldkeys & KEY_SECONDARY_ATTACK)) { switch(GetPVarInt(playerid, "vehicleID")) { case 425, 432, 464, 476: { SetPlayerHealth(playerid, 0); SendClientMessage(playerid, -1, "You have been killed because you dmed"); } } } else if((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK)) { switch(GetPVarInt(playerid, "vehicleID")) { case 520: { SetPlayerHealth(playerid, 0); SendClientMessage(playerid, -1, "You have been killed because you dmed"); } } } } return 1; }
|
lol.. i wanted to ask the same but i dont want to kill the player i want the player he shoot will not get hitted ( the vehicle will not explode and the player will not loose health)
so can you tell
me how can i do somthing like this?
(it will be useless if i will make another thread like that,just with other torget :\)
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
Pinguinn - 26.08.2011
Quote:
Originally Posted by xkirill
lol.. i wanted to ask the same but i dont want to kill the player i want the player he shoot will not get hitted ( the vehicle will not explode and the player will not loose health)
so can you tell me how can i do somthing like this?
(it will be useless if i will make another thread like that,just with other torget :\)
|
You can try to change the OnPlayerShootPlayer include
Can you show me the lines?
EDIT: I just figured out that all vehicles shoots with CTRL. Try this
You can remove 'SetPVarInt(playerid, "vehicleID", vehicleid);' at OnPlayerEnterVehicle
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new vehicleid = GetPlayerVehicleID(playerid);
model = GetVehicleModel(vehicleid);
if(IsPlayerInAnyVehicle(playerid))
{
if((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
{
switch(model)
{
case 425, 432, 464, 476, 520:
{
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid, -1, "You have been killed because you dmed");
}
}
}
}
return 1;
}
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
[EDT]AmanSingh123 - 26.08.2011
Quote:
Originally Posted by Pinguinn
You can try to change the OnPlayerShootPlayer include
EDIT: I just figured out that all vehicles shoots with CTRL. Try this
You can remove 'SetPVarInt(playerid, "vehicleID", vehicleid);' at OnPlayerEnterVehicle
|
i added the one you added added later and it's reduced my errors but now i got these two errors..
Quote:
C:\Users\Aman\Desktop\GTA\its a server\windows\gamemodes\elitedrift.pwn(3831) : error 017: undefined symbol "model"
C:\Users\Aman\Desktop\GTA\its a server\windows\gamemodes\elitedrift.pwn(3836) : error 017: undefined symbol "model"
|
Re: is it possible to kill someone who shoots from a dm vehicle like a Rhino? -
Pinguinn - 26.08.2011
Quote:
Originally Posted by [EDT]AmanSingh123
i added the one you added added later and it's reduced my errors but now i got these two errors..
|
Oops, replace
pawn Код:
new vehicle = GetPlayerVehicleID(playerid);
with
pawn Код:
new model, vehicle = GetPlayerVehicleID(playerid);