Simple anti drive by for SA-MP 0.3b -
BuLLeT[LTU] - 22.08.2010
Hello. This is anti drive by (it's working correctly with SA-MP 0.3b).
pawn Код:
new PlayerWeapon[MAX_PLAYERS][13];
new PlayerAmmo[MAX_PLAYERS][13];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
for (new i = 0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, PlayerWeapon[playerid][i], PlayerAmmo[playerid][i]);
}
ResetPlayerWeapons(playerid);
}
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
for(new i=0;i<13;i++)
{
GivePlayerWeapon(playerid,PlayerWeapon[playerid][i],PlayerAmmo[playerid][i]);
}
}
return 1;
}
Do not forget to reset PlayerWeapon and PlayerAmmo variables on OnPlayerDisconnect or OnPlayerConnect.
Re: Simple anti drive by for SA-MP 0.3b -
wups - 22.08.2010
I have a better idea.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( (newkeys & KEY_FIRE && newkeys & KEY_LOOK_LEFT ) || (newkeys & KEY_FIRE && newkeys & KEY_LOOK_RIGHT )
Kick(playerid);
return 1;
}
P.S.Matau esi lietuvis
Re: Simple anti drive by for SA-MP 0.3b -
sergio_xd - 22.08.2010
God... Have some utility For RP Servers.
Re: Simple anti drive by for SA-MP 0.3b -
BuLLeT[LTU] - 22.08.2010
Quote:
Originally Posted by wups
I have a better idea.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if( (newkeys & KEY_FIRE && newkeys & KEY_LOOK_LEFT ) || (newkeys & KEY_FIRE && newkeys & KEY_LOOK_RIGHT ) Kick(playerid); return 1; }
P.S.Matau esi lietuvis
|
I don't think this is better. First you have to check if is player driver. And if it is detected, you have to do something with this player. Kick - i don't think players would like it.. You can set RemovePlayerFromVehicle, it's better.
Re: Simple anti drive by for SA-MP 0.3b -
wups - 22.08.2010
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if( (newkeys & KEY_FIRE && newkeys & KEY_LOOK_LEFT ) || (newkeys & KEY_FIRE && newkeys & KEY_LOOK_RIGHT )
Stop(playerid);
}
return 1;
}
Alright?
Re: Simple anti drive by for SA-MP 0.3b -
H0rn - 22.08.2010
BanEx(playerid,"Noob Dber");
Respuesta: Simple anti drive by for SA-MP 0.3b -
ipsBruno - 22.08.2010
GivePlayerGun? O.o
Re: Simple anti drive by for SA-MP 0.3b -
RenisiL - 23.08.2010
Optimized version ( Better )
pawn Code:
new
PlayerWeapon[ MAX_PLAYERS ][ 13 ], // Variable [ 1 ]
PlayerAmmo [ MAX_PLAYERS ][ 13 ]; // Variable [ 2 ]
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if( newstate == PLAYER_STATE_DRIVER )
{
for( new i = false; i<13; i++ )
{
GetPlayerWeaponData( playerid, i, PlayerWeapon[ playerid ][ i ], PlayerAmmo[ playerid ][ i ] );
}
ResetPlayerWeapons ( playerid );
}
if( oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT )
{
for( new i = false; i<13; i++ )
{
GivePlayerWeapon( playerid, PlayerWeapon[ playerid ][ i ],PlayerAmmo[ playerid ][ i] );
}
}
return true;
}
Re: Simple anti drive by for SA-MP 0.3b -
BuLLeT[LTU] - 23.08.2010
How it's better? It's the same..
Re: Simple anti drive by for SA-MP 0.3b -
RenisiL - 23.08.2010
used a little less cpu
Re: Simple anti drive by for SA-MP 0.3b -
BuLLeT[LTU] - 23.08.2010
You just changed new to one and 1 to true, 0 - false. And how it will use less cpu? 0.0000001 % less of CPU?
Re: Simple anti drive by for SA-MP 0.3b -
MisterTickle - 23.08.2010
I think the idea of removing the players weapons when they enter a vehicle and giving them back when they exit is a FANTASTIC idea compared to other ones I've seen, What if I wan't to be in First Person and look to my side or I do it by accident its going to kick me? Seems like a waste.
Re: Simple anti drive by for SA-MP 0.3b -
Hip-hop - 01.09.2010
Don't work , when i exit the car , i lost all weapon ...
Re: Simple anti drive by for SA-MP 0.3b -
Calgon - 02.09.2010
Setting the player's weapon to fists is more sufficient, no idea why SetPlayerArmedWeapon doesn't work in vehicles though.
Re: Simple anti drive by for SA-MP 0.3b -
VantagePoint - 02.09.2010
Can i ask what exactly is wrong with drive bying? i never saw it as a bad thing lol
Re: Simple anti drive by for SA-MP 0.3b -
Gigi-The-Beast - 02.09.2010
the problem is because when you shoot from the car with a submachine gun on a pedestrian, you shoot a lot faster then when you are on foot
so thats why dbing is baned on roleplay servers
this code should work:
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerState(killerid) == 2)
{
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(killerid, COLOR_YELLOW, "That was a drive-by kill. Don't do that again!");
Kick(killerid);
return 1;
}
}
return 1;
}
Re: Simple anti drive by for SA-MP 0.3b -
Las Venturas CNR - 15.09.2010
Quote:
Originally Posted by wups
I have a better idea.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if( (newkeys & KEY_FIRE && newkeys & KEY_LOOK_LEFT ) || (newkeys & KEY_FIRE && newkeys & KEY_LOOK_RIGHT ) Kick(playerid); return 1; }
P.S.Matau esi lietuvis
|
Bad idea, in my own server, I don't allow DDB, but I constantly look left and right to check my surroundings.
Lots of people besides be do this.
Re : Simple anti drive by for SA-MP 0.3b -
spiirou - 19.09.2010
2nd Optimized version :
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerInAnyVehicle(killerid)) Kick(killerid);
return 1;
}
Re: Simple anti drive by for SA-MP 0.3b -
royal_king - 19.09.2010
nice one mate
Re: Simple anti drive by for SA-MP 0.3b -
Retardedwolf - 19.09.2010
Quote:
Originally Posted by wups
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if( (newkeys & KEY_FIRE && newkeys & KEY_LOOK_LEFT ) || (newkeys & KEY_FIRE && newkeys & KEY_LOOK_RIGHT ) Stop(playerid); } return 1; }
Alright?
|
What about on bikes?