Bernt Posted April 13, 2009 Report Share Posted April 13, 2009 Hello,I have a qeustion.Can some body help me, i have this call script, but who can makes that the script calls the nearst car?Thnxs.//////////////////////////////////////////////////////////////////////////////////////////////////////////// Freeplay Alarm STW - Script v1.7 //// ************************************************ //// //// 1.0| PCmdFPAlarmSTW //// //// _____________________ //// // //////////////////////////////////////////////////////////////////////////////////////////////////////////const char IMG_ICON[] = "STW";const char IMG_CURSOR[] = "STW";const char COMMANDABLE_TRUE[] = "DUMMYSetCommandableTrue";const char COMMANDABLE_FALSE[] = "DUMMYSetCommandableFalse";const char FREEFORALERT_TRUE[] = "DUMMYFPSetFreeForAlertTrue";const char FREEFORALERT_FALSE[] = "DUMMYFPSetFreeForAlertFalse";const char FREEFORALERT[] = "DUMMYFPIsFreeForAlert";const char INBASE_TRUE[] = "DUMMYFPSetInBaseTrue";const char INBASE_FALSE[] = "DUMMYFPSetInBaseFalse";const char INBASE[] = "DUMMYFPIsInBase";// 1.0object PCmdFPAlarmSTW : CommandScript{ PCmdFPAlarmSTW() { SetIcon(IMG_ICON); SetCursor(IMG_CURSOR); SetValidTargets(ACTOR_FLOOR | ACTOR_STREET); SetDoubleClickable(false); SetActivationByLeftClick(false); } bool CheckPossible(GameObject *Caller) { return true; } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { Person p(Caller); Vehicle v(Caller); if (p.HasName("LeitstellePerson") || v.HasName("ELW1") || v.HasName("KdoW") || v.HasName("FGRI") || v.HasName("ASF1") || v.HasName("ASF2") || v.HasName("ASF3") || v.HasName("STW1") || v.HasName("STW2") || v.HasName("STW3") || v.HasName("RTW1") || v.HasName("RTW2") || v.HasName("RTW3") || v.HasName("NEF1") || v.HasName("NEF2")) return true; if (Caller->GetID() == Target->GetID()) return false; return false; } void PushActions(GameObject *Caller, Actor *Target, int childID) { GameObjectList ol; GameObject *o; ol = Game::GetGameObjects("STW1"); o = *ol.GetObject(0); Vehicle v(o); GameObjectList ol1; GameObject *o1; ol1 = Game::GetGameObjects("STW2"); o1 = *ol1.GetObject(0); Vehicle v1(o1); GameObjectList ol2; GameObject *o2; ol2 = Game::GetGameObjects("STW3"); o2 = *ol2.GetObject(0); Vehicle v2(o2); Vector tpos; // nicht oder nur teilweise einsatzbereit if ((!v.HasCommand(FREEFORALERT)) && (!v1.HasCommand(FREEFORALERT)) && (!v2.HasCommand(FREEFORALERT))) { Mission::PlayHint("Kein STW verfuegbar!"); } else if ((v.HasCommand(FREEFORALERT)) || (v1.HasCommand(FREEFORALERT)) || (v2.HasCommand(FREEFORALERT))) { // einsatzort tpos = Game::GetCommandPos(); if (v.HasCommand(FREEFORALERT)) { Game::ExecuteCommand("PCmdFPAlarmSTW1",Caller,Target); } else if (v1.HasCommand(FREEFORALERT)) { Game::ExecuteCommand("PCmdFPAlarmSTW2",Caller,Target); } else if (v2.HasCommand(FREEFORALERT)) { Game::ExecuteCommand("PCmdFPAlarmSTW3",Caller,Target); } } else { Mission::PlayHint("Kein STW verfuegbar!"); return; } return; }}; Quote Link to comment Share on other sites More sharing options...
Newfoundking Posted April 14, 2009 Report Share Posted April 14, 2009 Hey Bernt,I know Hoppah's calling patrol vehicles sript calls the nearest vehicle to the sending location, you may want to take a look at that, I don't know exactly what goes on in there, never looked at that script for that before, so Hoppah or one of his team could probably elaborate on that Quote Link to comment Share on other sites More sharing options...