16.08.2013, 23:31
Part of it:
https://github.com/fusez/ripple/blob.../functions.pwn
pawn Код:
forward UpdateFirstPerson();
public UpdateFirstPerson()
{
foreach(new playerid : Player)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid, model;
vehicleid = GetPlayerVehicleID(playerid);
model = GetVehicleModel(vehicleid);
switch(model)
{
case 432,441,464,465,501,564,569,570,590,591,601,
606,607,608,610,611,460,476,511,512,513,520,553,
577,592,593,548,425,417,487,488,497,563,447,469:
{
SetPlayerFirstPersonMode(playerid,0);
}
default: SetPlayerFirstPersonMode(playerid,1);
}
}
else
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
{
if(IsPlayerMoving(playerid)) SetPlayerFirstPersonMode(playerid,2);
else SetPlayerFirstPersonMode(playerid,3);
}
else
{
if(IsPlayerMoving(playerid)) SetPlayerFirstPersonMode(playerid,4);
else SetPlayerFirstPersonMode(playerid,5);
}
}
}
return 1;
}
stock SetPlayerFirstPersonMode(playerid,mode)
{
if(GetTickCount() - pFirstPersonTick[playerid] < 500) mode = 0;
else pFirstPersonTick[playerid] = 0;
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING) return 0;
if(pFirstPersonMode[playerid] == mode) return 0;
pFirstPersonMode[playerid] = mode;
if(mode == 0) // Third Person
{
SetCameraBehindPlayer(playerid);
return 1;
}
if(!IsValidObject(pFirstPersonObj[playerid]))
pFirstPersonObj[playerid] = CreateObject(19300, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
switch(mode)
{
case 1:// First Person, In Vehicle
{
new vehicleid, model, seat, Float:x, Float:y, Float:z;
vehicleid = GetPlayerVehicleID(playerid);
model = GetVehicleModel(vehicleid);
seat = GetPlayerVehicleSeat(playerid);
switch(seat)
{
case 0,1: GetVehicleModelInfo(model, VEHICLE_MODEL_INFO_FRONTSEAT, x, y, z);
default: GetVehicleModelInfo(model, VEHICLE_MODEL_INFO_REARSEAT, x, y, z);
}
if(IsNumberEven(seat)) AttachObjectToVehicle(pFirstPersonObj[playerid], vehicleid, -x, y, z + 0.70, 0.0, 0.0, 0.0);
else AttachObjectToVehicle(pFirstPersonObj[playerid], vehicleid, x, y, z + 0.70, 0.0, 0.0, 0.0);
}
case 2:// First Person, Crouched & Moving
AttachObjectToPlayer(pFirstPersonObj[playerid], playerid, 0.10, 0.30, 0.30, 0.0, 0.0, 0.0);
case 3:// First Person, Crouched & Not Moving
AttachObjectToPlayer(pFirstPersonObj[playerid], playerid, 0.10, 0.25, 0.20, 0.0, 0.0, 0.0);
case 4:// First Person, Standing & Moving
AttachObjectToPlayer(pFirstPersonObj[playerid], playerid, 0.0, 0.30, 0.75, 0.0, 0.0, 0.0);
case 5:// First Person, Standing & Not Moving
AttachObjectToPlayer(pFirstPersonObj[playerid], playerid, 0.0, 0.10, 0.80, 0.0, 0.0, 0.0);
}
AttachCameraToObject(playerid, pFirstPersonObj[playerid]);
return 1;
}