new PlayerWeapons[MAX_PLAYERS][2][13]; //in the top
TogglePlayerWeapons(playerid, bool:toggle)
{
if(!toggle)
{
for(new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, PlayerWeapons[playerid][0][i], PlayerWeapons[playerid][1][i]);
if(PlayerWeapons[playerid][0][i]) GivePlayerWeapon(playerid, PlayerWeapons[playerid][0][i], - (PlayerWeapons[playerid][1][i] * 2) );
}
}
else
{
ResetPlayerWeapons(playerid);
for(new i = 0; i < 13; i++)
{
if(PlayerWeapons[playerid][0][i]) GivePlayerWeapon(playerid, PlayerWeapons[playerid][0][i], PlayerWeapons[playerid][1][i]);
}
}
return 1;
}
new
iLastDamage[MAX_PLAYERS];
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
if (damagedid != INVALID_PLAYER_ID)
{
iLastDamage[damagedid] = GetTickCount();
}
}
public OnPlayerDeath(playerid, killerid, reason)
{
if (killerid != INVALID_PLAYER_ID && (iLastDamage[playerid] + 2000) < GetTickCount())
{
static
szKickMessage[128],
szPlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
format(szKickMessage, 128, "* %s has been kicked because of doing a fake kill.", szPlayerName);
SendClientMessageToAll(-1, szKickMessage);
return Kick(playerid);
}
}
That will probably suffer a couple false-positives because the killer could be lead aiming each shot (using a deagle, for example), only hitting the player getting killed for him.
|
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/CreateObject", true) == 0)
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: {FF0000}/CreateObject [objectid]");
new Float:X,Float:Y,Float:Z,Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid, A);
CreateObject(strval(tmp), X,Y,Z,0,0,A);
SendClientMessage(playerid,0xFFFFFFFF, "{33FF33}Object Created!");
return 1;
}
return 0;
}
public OnPlayerDeath( playerid, killerid, reason )
{
if( IsPlayerConnected( killerid ) )
{
if( IsPlayerConnected( GetPVarInt( playerid, "LastKilled" ) ) && GetPVarInt( playerid, "LastKilled" ) == killerid )
{
if( ( GetPVarInt( playerid, "LastKilledTickcount" ) - GetTickCount( ) ) < 500 )
{
SetPVarInt( playerid, "LastKilledTick", GetPVarInt( playerid, "LastKilledTick" ) + 1 );
if( GetPVarInt( playerid, "LastKilledTick" ) > 1 ) Kick( playerid );
}
SetPVarInt( playerid, "LastKilledTickcount", GetTickCount( ) );
}
SetPVarInt( playerid, "LastKilled", killerid );
}
return 1;
}
pawn Code:
|
/*
*
* OnPlayerMovedCamera - Somente na versгo 0.3e RC2 ou superior.
*
* Crйditos: DarkScripter
* - Nгo retire os crйditos.
*
*
*/
new bool:Chamed_Int[MAX_PLAYERS char] = false;
forward _FinisOnPlayerMovedCamera(playerid);
forward OnPlayerMovedCamera(playerid);
public _FinisOnPlayerMovedCamera(playerid)
{
Chamed_Int{playerid} = false;
CallLocalFunction("OnPlayerMovedCamera", "d", playerid);
}
stock InterpolateCameraLookAt_(p, Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, time, style)
{
InterpolateCameraLookAt(p, Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, time, style);
return !Chamed_Int{p} ? (SetTimerEx("_FinisOnPlayerMovedCamera", time, false, "d", p), Chamed_Int{p} = true) : true;
}
stock InterpolateCameraPos_(p, Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, time, style)
{
InterpolateCameraPos(p, Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, time, style);
return !Chamed_Int{p} ? (SetTimerEx("_FinisOnPlayerMovedCamera", time, false, "d", p), Chamed_Int{p} = true) : true;
}
#define InterpolateCameraLookAt InterpolateCameraLookAt_
#define InterpolateCameraPos InterpolateCameraPos_
#include <a_samp>
#define TIMER ( 60000 * 1 ) // time to move cam ( 1 minute )
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/cam", true))
{
TogglePlayerSpectating(playerid, true);
InterpolateCameraLookAt(playerid, 2045.2523, 1689.3992, 10.3990 + 50, 1336.8778, -2271.4685, 13.1868 + 50, TIMER, CAMERA_MOVE);
InterpolateCameraPos(playerid, 2045.2523, 1689.3992, 10.3990 + 50, 1336.8778, -2271.4685, 13.1868 + 50, TIMER, CAMERA_MOVE);
return true;
}
if(!strcmp(cmdtext,"/b", true))
{
TogglePlayerSpectating(playerid, false);
SetCameraBehindPlayer(playerid);
return true;
}
return true;
}
public OnPlayerMovedCamera(playerid)
{
SendClientMessage(playerid, -1,"Arrived.");
return 1;
}
OnPlayerMovedCamera - The callback's 0.3e RC2 above Only
pawn Код:
pawn Код:
|
#define IsASemi(%0) ((%0) == 403 || (%0) == 514 || (%0) == 515 || (%0) == 443)
#define IsATrailor(%0) ((%0) == 435 || (%0) == 450 || (%0) == 584 || (%0) == 591 || (%0) == 606 || (%0) == 607 || (%0) == 608 || (%0) == 610 || (%0) == 611)
#define IsACopCar(%0) ((%0) == 523 || (%0) == 427 || (%0) == 490 || (%0) == 528 || (%0) == 596 || (%0) == 598 || (%0) == 597 || (%0) == 599 || (%0) == 601)
#define IsAMotorBike(%0) ((%0) == 462 || (%0) == 448 || (%0) == 581 || (%0) == 522 || (%0) == 461 || (%0) == 521 || (%0) == 523 || (%0) == 463 || (%0) == 586 || (%0) == 468)
#define IsABike(%0) ((%0) == 809 || (%0) == 481 || (%0) == 510)
#define IsAPizzaBike(%0) ((%0) == 448)
#define IsAFireTruck(%0) ((%0) == 407 || (%0) == 544)
#define IsATaxi(%0) ((%0) == 438 || (%0) == 420)
#define IsABus(%0) ((%0) == 431 || (%0) == 437)
#define IsAAmbulance(%0) ((%0) == 416)
#define IsALimo(%0) ((%0) == 409)
#define IsAPlane(%0) ((%0) == 460 || (%0) == 476 || (%0) == 511 || (%0) == 512 || (%0) == 513 || (%0) == 519 || (%0) == 520 || (%0) == 553 || (%0) == 577 || (%0) == 592 || (%0) == 593)
#define IsAHeli(%0) ((%0) == 542 || (%0) == 425 || (%0) == 417 || (%0) == 487 || (%0) == 488 || (%0) == 497 || (%0) == 563 || (%0) == 447 || (%0) == 469)
#define IsABoat(%0) ((%0) == 472 || (%0) == 473 || (%0) == 493 || (%0) == 595 || (%0) == 484 || (%0) == 430 || (%0) == 453 || (%0) == 452 || (%0) == 446 || (%0) == 454)
#define IsATrashTruck(%0) ((%0) == 408)
if(IsASemi(vehiclemodelid)){/*code here*/}
#define MAX_TANKS 10
#define STRIKE_COOLDOWN 1 //I've defined this as one minute, however, you can change this as needed.
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
new
StrikeCooldown[ MAX_PLAYERS ];
new
TanksSpawned = 0,
Tank[ MAX_TANKS ];
//Tanks
Tank[ 0 ] = AddStaticVehicle( 432, 235.2255,17.2768,2.4297,143.3092, 3, 3 );
Tank[ 1 ] = AddStaticVehicle( 432, 212.7084,-21.6392,1.4297,94.7918, 3, 3 );
public OnPlayerDisconnect( playerid, reason )
{
if( GetPVarInt( playerid, "ExpTank" ) == 1)
{
KillTimer( StrikeCooldown[ playerid ] );
}
return true;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( HOLDING( KEY_AIM ) )
{
if( GetPlayerWeapon( playerid ) == 43 )
{
new
Float: TankLoc[ 3 ];
for( new tk; tk < MAX_TANKS; tk ++ )
{
GetVehiclePos( Tank[ tk ], TankLoc[ 0 ], TankLoc[ 1 ], TankLoc[ 2 ] );
if( IsPlayerAimingAt( playerid, TankLoc[ 0 ], TankLoc[ 1 ], TankLoc[ 2 ], 3.0 ) )
{
if( GetPVarInt( playerid, "ExpTank" ) == 0 )
{
SetTimerEx( "ExplodeThatBitch", 5000, false, "ii", tk, playerid );
SendClientMessage( playerid, c_ORANGE, "Strike requested! Continue aiming at the Tank!" );
}
else return SendClientMessage( playerid, c_ORANGE, "You've recently called in an airstrike! Please wait 5 minutes." );
}
}
}
}
return true;
}
forward ExplodeThatBitch( TankID, playerid );
public ExplodeThatBitch( TankID, playerid )
{
new
Float: TankLoc[ 3 ],
String[ 128 ],
p_Name[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, p_Name, sizeof( p_Name ) );
for( new tk; tk < MAX_TANKS; tk ++ )
{
GetVehiclePos( Tank[ tk ], TankLoc[ 0 ], TankLoc[ 1 ], TankLoc[ 2 ] );
if( IsPlayerAimingAt( playerid, TankLoc[ 0 ], TankLoc[ 1 ], TankLoc[ 2 ], 3.0 ) )
{
CreateExplosion( TankLoc[ 0 ], TankLoc[ 1 ], TankLoc[ 2 ], 0, 10.0 );
format( String, sizeof( String ), "%s has called in a Strike!", p_Name );
SendClientMessageToAll( c_ORANGE, String );
SetPVarInt( playerid, "ExpTank", 1 );
StrikeCooldown[ playerid ] = SetTimerEx( "ResetCooldown", 60000*STRIKE_COOLDOWN, false, "i", playerid );
return true;
}
else
{
SendClientMessage( playerid, c_ORANGE, "Target not found!" );
SetPVarInt( playerid, "ExpTank", 0 );
return true;
}
}
return true;
}
forward ResetCooldown( playerid );
public ResetCooldown( playerid )
{
SetPVarInt( playerid, "ExpTank", 0 );
SendClientMessage( playerid, c_ORANGE, "You may now use your Strike capabilities!" );
return true;
}
Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ) {
new Float:TGTDistance;
TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));
new Float:tmpX, Float:tmpY, Float:tmpZ;
tmpX = FrX * TGTDistance + CamX;
tmpY = FrY * TGTDistance + CamY;
tmpZ = FrZ * TGTDistance + CamZ;
return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
}
stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
{
new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float:fz;
GetPlayerCameraPos(playerid, cx, cy, cz);
GetPlayerCameraFrontVector(playerid, fx, fy, fz);
return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
}
//These are NOT my functions, although I'm not positive where they came from..
stock FiftyFifty(playerid)
{
SetPlayerHealth(playerid,50)
SetPlayerArmour(playerid,50.0);
return 1;
}
What are you on about? Saying something is the best you've ever seen is a complement, not an insult!
|