public OnPlayerUpdate(playerid)
{
if(!Player[playerid][onDuty])
updateWanted(playerid);
//-------- Sweeper Job ---------------------------------------------------//
if(SweeperJob[playerid] && GetVehicleModel(GetPlayerVehicleID(playerid)) == 574 && SweeperUpdate[playerid] < tickcount())
{
SweeperUpdate[playerid] = tickcount()+UPDATE_TIME;
SweeperDistance[playerid] += floatround(GetPlayerDistanceFromPoint(playerid, SweeperLastPos[playerid][0], SweeperLastPos[playerid][1], SweeperLastPos[playerid][2]));
GetPlayerPos(playerid, SweeperLastPos[playerid][0], SweeperLastPos[playerid][1], SweeperLastPos[playerid][2]);
new string[64];
format(string, sizeof(string), "~b~~h~Sweeper Job~n~~n~~w~Cleaned: ~y~%d Meters", SweeperDistance[playerid]);
PlayerTextDrawSetString(playerid, SweeperText[playerid], string);
}
//-------------------------------------------------------------------------------//
if(Player[playerid][onDerby])
{
new Float:x, Float:y, Float:z, msg[256];
format(msg, sizeof(msg), "[Derby]: %s has fallen from the map.", GetName(playerid));
GetPlayerPos(playerid, x, y, z);
if(z < -1.00)
{
foreach(new i : Player)
{
if(Player[i][onDerby])
//Info(i, msg);
SendClientMessage(i,COLOR_ORANGE,msg);
}
loadData(playerid);
Player[playerid][onDerby] = false;
}
}
if(Player[playerid][onFallout])
{
new Float:x, Float:y, Float:z, msg[512];
format(msg, sizeof(msg), "[Fallout]: %s has dropped out of Fallout event.", GetName(playerid));
GetPlayerPos(playerid, x, y, z);
if(z < 2.00)
{
foreach(new i : Player)
{
if(Player[i][onFallout])
//Info(i, msg);
SendClientMessage(i,COLOR_ORANGE,msg);
}
loadData(playerid);
SetCameraBehindPlayer(playerid);
Player[playerid][onFallout] = false;
}
}
if(GetPVarInt(playerid,"YEAH") == 1)
{
new
Float:VPos[3],
Float:Rotation
;
GetVehiclePos(GetPlayerVehicleID(playerid), VPos[0], VPos[1], VPos[2]);
Rotation = PointAngle(playerid, VPos[0], VPos[1], GetPVarFloat(playerid, "Spongebob"), GetPVarFloat(playerid, "Mario"));
if(!Player[playerid][truckingMission])
AttachObjectToVehicle(GPSObject[playerid], GetPlayerVehicleID(playerid), 0.0, 0.0, 1.5, 0.0, 90.0, Rotation);
else
AttachObjectToVehicle(GPSObject[playerid], GetPlayerVehicleID(playerid), 0.0, 0.0, 3.5, 0.0, 90.0, Rotation);
}
return 1;
}
foreach(new i : Player)
{
if(Player[i][onFallout])
//Info(i, msg);
SendClientMessage(i,COLOR_ORANGE,msg);
}
Only use OnPlayerUpdate if it's the only thing you can use (e.g. detecting pause).
|