SA-MP Forums Archive
Converting dialog in zcmd command? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Converting dialog in zcmd command? (/showthread.php?tid=560543)



Converting dialog in zcmd command? - uTorrent - 29.01.2015

Hey.
Someone could kindly help me convert this dialog in commands such as /engine, /lights, etc?

PHP код:
 case 4// Vehicle option dialog
        
{
            switch(
response)
            {
                case 
1// Selecting
                
{
                    switch(
listitem)
                    {
                         case 
0// Toggle engine
                         
{
                              if(
VehicleInfo[GetPlayerVehicleID(playerid)][vFuel] == 0)
                              {
                                  
TogglePlayerControllableEx(playerid,false);
                                  return 
SendClientMessage(playerid,COLOR_LIGHTRED,"There is no more fuel in your vehicle.");
                              }
                              if(
VehicleInfo[GetPlayerVehicleID(playerid)][vWireTime] > 0)
                              {
                                  
RemovePlayerFromVehicleEx(playerid);
                                  return 
SendClientMessage(playerid,COLOR_LIGHTRED,"You must wait for the vehicle's hotwiring delay to complete !");
                             }
                             new 
Float:ghealthhealth;
                             
GetVehicleHealth(GetPlayerVehicleID(playerid),ghealth);
                             
health floatround(ghealth);
                             if(
health <= 300)
                             {
                                 
RemovePlayerFromVehicleEx(playerid);
                                  return 
SendClientMessage(playerid,COLOR_LIGHTRED,"The vehicle is currently damaged !");
                             }
                             new 
string[128],sendername[MAX_PLAYER_NAME];
                             
format(sendernamesizeof(sendername), "%s"PlayerNameEx(playerid));
                             
GiveNameSpace(sendername);
                              switch(
VehicleInfo[GetPlayerVehicleID(playerid)][vEngine])
                              {
                                  case 
0:
                                  {
                                      
format(stringsizeof(string), "Attempting to start the %ss engine."VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
                                      
SendClientMessage(playeridCOLOR_WHITEstring);
                                      new 
RandomStart;
                                      
RandomStart random(4);
                                      switch(
RandomStart)
                                      {
                                          case 
0,1,2:
                                          {
                                              
VehicleInfo[GetPlayerVehicleID(playerid)][vEngine] = 1;
                                              
CarEngine(GetPlayerVehicleID(playerid),1);
                                              
TogglePlayerControllableEx(playerid,true);
                                              
format(stringsizeof(string), "%ss engine turned [ON]"VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
                                              
SendClientMessage(playeridCOLOR_WHITEstring);
                                              
CarLights(GetPlayerVehicleID(playerid),1);
                                              new 
key VehicleInfo[GetPlayerVehicleID(playerid)][vOwned];
                                              if(
key != SCRIPT_CARS)
                                              {
                                                 if(
CarInfo[key][cBomb] == 1)
                                                 {
                                                     new 
Float:XFloat:YFloat:Zvehicleid GetPlayerVehicleID(playerid);
                                                     
GetVehiclePos(vehicleidXYZ);
                                                     
SetVehicleVelocity(vehicleid000.2);
                                                     
SendFactionMessage(4COLOR_PINK"HQ: All Units - HQ: Vehicle explosion.");
                                                     
format(stringsizeof(string), "HQ: Location: %s"GetZone(XYZ));
                                                     
SendFactionMessage(4COLOR_PINKstring);
                                                     
CreateFire(XYZ00);
                                                     
CreateExplosion(XYZ1215.0);
                                                     
CreateExplosion(XYZ1215.0);
                                                     foreach (
Player,i)
                                                     {
                                                         if(
GetPVarInt(i"PlayerLogged") == && GetPlayerVehicleID(i) == vehicleid)
                                                         {
                                                             
SetPlayerPos(iXYZ+0.5);
                                                             
SetPlayerHealth(i,1.0);
                                                             
SetPlayerHealth(i,0.0);
                                                         }
                                                     }
                                                     
SetVehicleHealth(vehicleid15.0);
                                                     
CarInfo[key][cBomb]=0;
                                                     
CarInfo[key][cHealth]=15.0;
                                                     
SaveCars();
                                                     
SaveCars2();
                                                 }
                                              }
                                          }
                                          case 
3:
                                          {
                                              
format(stringsizeof(string), "The attempt to start the %ss engine has failed !"VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
                                              
SendClientMessage(playeridCOLOR_WHITEstring);
                                              
ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Vehicle Options","{33FF66}Toggle Engine\n{33FF66}Idle\n{33FF66}Lights\n{33FF66}Exit Vehicle","Continue""Cancel");
                                          }
                                      }
                                  }
                                  case 
1:
                                  {
                                      
VehicleInfo[GetPlayerVehicleID(playerid)][vEngine] = 0;
                                      
CarEngine(GetPlayerVehicleID(playerid),0);
                                     
ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Vehicle Options","{33FF66}Toggle Engine\n{33FF66}Idle\n{33FF66}Lights\n{33FF66}Exit Vehicle","Continue""Cancel");
                                     
format(stringsizeof(string), "%ss engine turned [OFF]"VehicleName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
                                      
SendClientMessage(playeridCOLOR_WHITEstring);
                                     
CarLights(GetPlayerVehicleID(playerid),2);
                                  }
                             }
                         }
                         case 
1// IDLE
                         
{
                             new 
Float:health;
                             
GetVehicleHealth(GetPlayerVehicleID(playerid),health);
                             if(
health 300.0) return SendClientMessage(playerid,COLOR_WHITE,"You can't idle in a damaged vehicle.");
                             if(
VehicleInfo[GetPlayerVehicleID(playerid)][vFuel] == 0)
                              {
                                  
TogglePlayerControllableEx(playerid,false);
                                  return 
SendClientMessage(playerid,COLOR_LIGHTRED,"There is no more fuel in the vehicle !");
                              }
                             if(
VehicleInfo[GetPlayerVehicleID(playerid)][vEngine] == 0SendClientMessage(playerid,COLOR_WHITE,"You are now idle inside your vehicle, remember to use /vehicle.");
                             else 
SendClientMessage(playerid,COLOR_WHITE,"Your engine needs to be off to use this option.");
                         }
                         case 
2// Lights
                         
{
                             if(
VehicleInfo[GetPlayerVehicleID(playerid)][vFuel] == 0)
                              {
                                  
TogglePlayerControllableEx(playerid,false);
                                  return 
SendClientMessage(playerid,COLOR_LIGHTRED,"There is no more fuel in the vehicle !");
                              }
                             if(
VehicleInfo[GetPlayerVehicleID(playerid)][vEngine] == 0)
                             {
                                 
SendClientMessage(playerid,COLOR_WHITE,"This vehicle's engine is off.");
                                 return 
TogglePlayerControllableEx(playerid,false);
                             }
                             switch(
VehicleInfo[GetPlayerVehicleID(playerid)][vLights])
                             {
                                 case 
1:
                                 {
                                     
CarLights(GetPlayerVehicleID(playerid),2);
                                     
GameTextForPlayer(playerid"~w~Lights~n~~r~Off"40003);
                                 }
                                    case 
2:
                                    {
                                     
CarLights(GetPlayerVehicleID(playerid),1);
                                     
GameTextForPlayer(playerid"~w~Lights~n~~g~On"40003);
                                 }
                             }
                         }
                         case 
3// Exit Car
                         
{
                             
SendClientMessage(playerid,COLOR_WHITE,"You left the vehicle.");
                             
TogglePlayerControllableEx(playerid,true);
                             
RemovePlayerFromVehicleEx(playerid);
                         }
                    }
                }
            }
        } 
if someone is kind enough to help me...