04.12.2015, 15:03
Код:
CMD:ar(playerid, params[]) { if(GetPVarInt(playerid,"AirReconOnline")) return SendClientMessage(playerid,COLOR_RED,"ERROR: You have already set the Air Recon Online!"); if(gTeam[playerid] != TEAM_Internationalforces) return SendClientMessage(playerid,COLOR_RED,"ERROR: Your team dosent have Satellite!"); if(gTeam[playerid] == TEAM_Internationalforces) { if(GetPlayerMoney(playerid) < 90000) return SendClientMessage(playerid,0xFF0000FF,"You dont have money to use Satellite!"); SendClientMessage(playerid,COLOR_BLUE,"i need air recon online!"); SendClientMessage(playerid,COLOR_BLUE,"copy that we are coming to your position in 2 sec!"); SendClientMessage(playerid,COLOR_RED,"You lost $90000 for air recon."); GivePlayerMoney(playerid, -90000); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY); TogglePlayerControllable(playerid, 0); new Float:x, Float:y, Float:z, Float:a, laptop_objid; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); laptop_objid = CreateObject(19894, x + (0.5 * floatsin(-a, degrees)), y + (0.5 * floatcos(-a, degrees)), z + 0.15, 0.0, 0.0, a); SetTimerEx("startairrecon", 2000, false, "iiffff", playerid, laptop_objid, x, y, z, a); } return 1; } public startairrecon(playerid, laptop_objid, Float:x, Float:y, Float:z, Float:a) { SetPVarInt(playerid,"AirReconOnline",true); SendClientMessage(playerid,COLOR_BLUE,"We are in your position you can use Satellite!"); GivePlayerWeapon(playerid, 0, 1); DestroyObject(laptop_objid); new objid; objid = CreateObject(19893, x + (0.4 * floatsin(-a, degrees)), y + (0.4 * floatcos(-a, degrees)), z + 0.16, 0.0, 0.0, a); SetPlayerCameraPos(playerid, x, y, z+30.0); SetPlayerCameraLookAt(playerid, x, y, z); SetTimerEx("endar", 60000, false, "ii", playerid, objid); return 1; } public endar(playerid, laptop_objid) { DestroyObject(laptop_objid); new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); // trigonometry "magic", adjust numbers at will x += 0.5 * floatsin(-a, degrees); y += 0.5 * floatcos(-a, degrees); z += 0.15; // optionally you may want to save the object id // so you can remove the object afterwards CreateObject(19894, x, y, z, 0.0, 0.0, a); // presumably you want this too + SetCameraBehindPlayer() SetCameraBehindPlayer(playerid); DeletePVar(playerid,"AirReconOnline"); SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE); TogglePlayerControllable(playerid, 1); return 1; }