12.12.2012, 19:17
pawn Код:
forward breakincar(p, v, pvid, pid);
public breakincar(p, v, pvid pid)
{
if(GetPVarInt(p, "breakin") != 1)
{
tdrawtimer[p] = 0;
return KillTimer[BreakTimer[p]];
}
if(tdrawtimer[p] == 60)
{
new r = rand(3);
if(r < 2)
{
SendClientMessage(playerid, COLOR_GREY, "You have failed to break into the car.");
PlayerInfo[p][pCrowbar]--;
DeletePVar(p, "breakin");
tdrawtimer[p] = 0;
KillTimer(BreakTimer[p]);
return 1;
}
else
{
GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
SetTimerEx("DisableVehicleAlarm", 20000, 0, "d", newcar);
PlayerVehicleInfo[pid][pvid][pvLocked] = 0;
SendClientMessage(playerid, COLOR_WHITE, "You have successfully broken into the vehicle.");
PutPlayerInVehicle(playerid, PlayerVehicleInfo[pid][pvid][pvId]);
return 1;
}
}
new Float:X, Float:Y, Float:Z;
GetVehiclePos(veh, X, Y, Z);
if(IsPlayerInRangeOfPoint(p, 10, X, Y, Z))
{
new str[5];
format(str, 5, "%i",60-tdrawtimer[p]);
tdrawtimer[p]++;
GameTextForPlayer(p, str, 1000, 1);
return 1;
}
else
{
SendClientMessage(p, COLOR_GREY, "You are no longer breaking into the vehicle due to moving away from it.");
new string[128];
if(PlayerInfo[p][pMask])
{
format(string, 128, "* Stranger %i places back the crowbar onto his backpack and stops breaking into the vehicle.", HasBoughtMask[p]);
}
else
{
format(string, 128, "* %s places back the crowbar onto his backpack and stops breaking into the vehicle.", GetPlayerNameEx(p));
}
ProxDetector(10.0, p, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
DeletePVar(p, "breakin");
tdrawtimer[p] = 0;
KillTimer(BreakTimer[p]);
}
}