31.12.2014, 01:50
How can you make from this one command that you only need to do /dcam and it will be activated or disabled
pawn Код:
CMD:rdcam(playerid, params[])
{
if (IsPlayerInAnyVehicle (playerid))
{
if(IsACop(playerid))
{
new vehid = GetPlayerVehicleID (playerid);
if (VehRadarID [vehid] == -1) return 1;
DestroyObject (VehRadarID [vehid]);
SendClientMessage (playerid, COLOR_GREY, "You removed the radar from the dashboard(don't forget to do /stopchecking).");
VehRadarID [vehid] = -1;
KillTimer (CheckingSpeed [vehid]);
CheckingSpeed [vehid] = -1;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerInVehicle (i, vehid))
{
PlayerTextDrawHide (i, RadarHud[i]);
PlayerTextDrawHide (i, VehicleModel[i]);
PlayerTextDrawHide (i, DashCamText);
}
}
}
}
return 1;
}
CMD:dcam(playerid, params[])
{
if (IsPlayerInAnyVehicle (playerid))
{
if(IsACop(playerid))
{
new vehid = GetPlayerVehicleID (playerid);
if (VehRadarID [vehid] > -1) return 1;
new Float: x, Float: y, Float: z, Float: a;
GetVehiclePos (vehid, x, y, z);
GetVehicleZAngle (vehid, a);
SendClientMessage (playerid, COLOR_GREY, "You have placed the radar(/checkspeed to check the speed).");
VehRadarID [vehid] = CreateObject (367, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 300.0);
AttachObjectToVehicle (VehRadarID [vehid], vehid, 0.2, 0.50, 0.3, 0.0, 0.0, 90.0);
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerInVehicle (i, vehid))
{
PlayerTextDrawShow (i,RadarHud[i]);
PlayerTextDrawShow (i,VehicleModel[i]);
PlayerTextDrawShow (i,DashCamText);
}
}
}
}
return 1;
}
CMD:record(playerid, params[])
{
if (IsPlayerInAnyVehicle (playerid))
{
if(IsACop(playerid))
{
new vehid = GetPlayerVehicleID (playerid);
if (VehRadarID [vehid] == -1) return 1;
CheckingSpeed [vehid] = SetTimerEx ("UpdateSpeed", 100, 1, "d", vehid);
}
}
return 1;
}
CMD:srecord(playerid, params[])
{
if(IsACop(playerid))
if (IsPlayerInAnyVehicle (playerid))
{
new vehid = GetPlayerVehicleID (playerid);
if (CheckingSpeed [vehid] > 0)
{
KillTimer (CheckingSpeed [vehid]);
CheckingSpeed [vehid] = -1;
}
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerInVehicle (i, vehid))
{
PlayerTextDrawHide (i, RadarHud[i]);
PlayerTextDrawHide (i, VehicleModel[i]);
PlayerTextDrawHide (i, DashCamText);
}
}
}
return 1;
}