SA-MP Forums Archive
In need of 2 codes :( CARPARK & HELIBLADE - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: In need of 2 codes :( CARPARK & HELIBLADE (/showthread.php?tid=431592)



In need of 2 codes :( CARPARK & HELIBLADE - Hittop65 - 19.04.2013

1st code needed is a anti-Heliblade code that kills the player who used a helicopter to kill other players & the code gives all players a message saying the killer was killed for killing another player if that makes sense. I'm using this code but its not working right.

if(reason == 50)
{
new str[752], pName[MAX_PLAYER_NAME];
GetPlayerName(killerid, pName, sizeof(pName));
SendClientMessageToAll(COLOR_RED, str);
format(string, sizeof(string), "%s (%d) has been killed for heli blade.", pName, playerid);
SetPlayerHealth(killerid,-1);

IM lost lol

The other code i need is like this:

if ( reason == 49 ) {
new kstring[128],
kickname[MAX_PLAYER_NAME],
String[50];
if ( IsPlayerConnected(killerid) ) {
GetPlayerName(killerid, kickname, sizeof(kickname));
format(String, 256, "AdmWarning: [%d] %s has just carparked a player.", killerid, kickname);
SendMessageToAdmins(String);
printf("%s", kstring);

But i don't need it to tell admins just send message to all players about this players punishment, DEATH would be a good thing maybe that will STOP CAR PARKING on my server.

Thanks for any and all help.


Re: In need of 2 codes :( CARPARK & HELIBLADE - zDivine - 19.04.2013

You can use OnPlayerDeath(), and find if the killerid was in a vehicle, and in the driver seat, and the one killed was not in a vehicle at all. Then you can tell if he was car parked.

Same goes for heli, detect if he's in a vehicle, and get the vehicle ID for all helicopters. Check if the one killed was not in any vehicle, and boom. Hope this helps.