Author Topic: [Func/Inc] GetVehicleModel + GetVehicleName for VC-MP 0.3z R2 by Saint Games  (Read 8624 times)

0 Members and 1 Guest are viewing this topic.

Offline [Saint]

  • Made Man
  • ***
  • Posts: 126
  • Pawn scripting for SA:MP and VC:MP
    • View Profile
    • vk.com/vicecitymultiplayer
GetVehicleModel + GetVehicleName for VC-MP 0.3z R2 by Saint Games

Code: [Select]
//==============================================================================

new VehiclesNames[][] =
{
   "Landstalker", // 130
   "Idaho", // 131
   "Stinger", // 132
   "Linerunner", // 133
   "Perennial", // 134
   "Sentinel", // 135
   "Rio", // 136
   "Firetruck", // 137
   "Trashmaster", // 138
   "Stretch", // 139
   "Manana", // 140
   "Infernus", // 141
   "Voodoo", // 142
   "Pony", // 143
   "Mule", // 144
   "Cheetah", // 145
   "Ambulance", // 146
   "FBI Washington", // 147
   "Moonbeam", // 148
   "Esperanto", // 149
   "Taxi", // 150
   "Washington", // 151
   "Bobcat", // 152
   "Mr Whoopee", // 153
   "BF Injection", // 154
   "Hunter", // 155
   "Police", // 156
   "Enforcer", // 157
   "Securicar", // 158
   "Banshee", // 159
   "Predator", // 160
   "Bus", // 161
   "Rhino", // 162
   "Barracks OL", // 163
   "Cuban Hermes", // 164
   "Helicopter", // 165 (íåîñèçàåìûé ïîëèöåéñêèé âåðòîë¸ò)
   "Angel", // 166
   "Coach", // 167
   "Cabbie", // 168
   "Stallion", // 169
   "Rumpo", // 170
   "RC Bandit", // 171
   "Romero's Hearse", // 172
   "Packer", // 173
   "Sentinel XS", // 174
   "Admiral", // 175
   "Squalo", // 176
   "Sea Sparrow", // 177
   "Pizza boy", // 178
   "Gang Burrito", // 179
   "???", // 180 (none)
   "???", // 181 (none)
   "Speeder", // 182
   "Reefer", // 183
   "Tropic", // 184
   "???", // 185 (none)
   "Yankee", // 186
   "Caddy", // 187
   "Zebra Cab", // 188
   "Top Fun", // 189
   "Skimmer", // 190
   "PCJ-600", // 191
   "Faggio", // 192
   "Freeway", // 193
   "RC Baron", // 194
   "RC Raider", // 195
   "Glendale", // 196
   "Oceanic", // 197
   "Sanchez", // 198
   "Sparrow", // 199
   "Patriot", // 200
   "Love Fist", // 201
   "Coast Guard", // 202
   "Dinghy", // 203
   "Hermes", // 204
   "Sabre", // 205
   "Sabre Turbo", // 206
   "Phoenix", // 207
   "Walton", // 208
   "Regina", // 209
   "Comet", // 210
   "Deluxo", // 211
   "Burrito", // 212
   "Spand Express", // 213
   "Marquis", // 214
   "Baggage", // 215
   "Kaufman Cab", // 216
   "Maverick", // 217
   "VCN Maverick", // 218
   "Rancher", // 219
   "FBI Rancher", // 220
   "Virgo", // 221
   "Greenwood", // 222
   "Cuban Jetmax", // 223
   "Hotring Racer #1", // 224
   "Sandking", // 225
   "Blista Compact", // 226
   "Police Maverick", // 227
   "Boxville", // 228
   "Benson", // 229
   "Mesa Grande", // 230
   "RC Goblin", // 231
   "Hotring Racer #2", // 232
   "Hotring Racer #3", // 233
   "Bloodring Banger #1", // 234
   "Bloodring Banger #2", // 235
   "Police Cheetah" // 236
};

//==============================================================================

new VehicleModel[MAX_VEHICLES]; // MAX_VEHICLES = 254 from include a_vcmp.inc
new Vehicle_ID[MAX_VEHICLES];

stock AddStaticVehicleFix(vehicleid, modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2)
{//-----------------------------------------------------------------------------
// printf("AddStaticVehicleFix(vehicleid: [%d], modelid: [%d])", vehicleid, modelid);
    VehicleModel[vehicleid] = modelid; //
  Vehicle_ID[vehicleid] = vehicleid;
// printf("AddStaticVehicleFix(Vehicle_ID[%d]:[%d], VehicleModel[%d]:[%d]", vehicleid, Vehicle_ID[vehicleid], vehicleid, VehicleModel[vehicleid]);
AddStaticVehicle(VehicleModel[vehicleid], spawn_x, spawn_y, spawn_z, z_angle, color1, color2);
}//-----------------------------------------------------------------------------

//==============================================================================

stock GetVehicleModelFix(vehicleid)
{//-----------------------------------------------------------------------------
// return 0 if vehicle create with standart function AddStaticVehicle (Eng)

return VehicleModel[Vehicle_ID[vehicleid]];

}//-----------------------------------------------------------------------------

//==============================================================================

stock GetVehicleName(vehicleid)
{//-----------------------------------------------------------------------------
new vehname[64];
if (GetVehicleModelFix(vehicleid) != 0)
    {//-------------------------------------------------------------------------
format(vehname, sizeof(vehname), "%s", VehiclesNames[GetVehicleModelFix(vehicleid) - 130]);
}//-------------------------------------------------------------------------
else
{//-------------------------------------------------------------------------
    format(vehname, sizeof(vehname), "dont know");
}//-------------------------------------------------------------------------

return vehname;
}//-----------------------------------------------------------------------------

//==============================================================================

the functions GetVehicleModelFix + GetVehicleName worked, need to create transport AddStaticVehicleFix

[pawn]
public OnGameModeInit()
{
   new vehicleid = 1;
   
   AddStaticVehicleFix(vehicleid++, 150, -1466.0442,  -813.6917, 14.4544, 194.7963,  6,  6); // id:  1 // Taxi on Air
   AddStaticVehicleFix(vehicleid++, 150, -1443.8861,  -835.5981, 14.5113, 256.3380,  6,  6); // id:  2 // Taxi on Air
   AddStaticVehicleFix(vehicleid++, 150, -1427.6191,  -835.4893, 14.5456, 285.4997,  6,  6); // id:  3 // Taxi on Air
   AddStaticVehicleFix(vehicleid++, 150, -1405.0720,  -813.2555, 14.5465, 346.7166,  6,  6); // id:  4 // Taxi on Air
[/pawn]

how to use

[pawn]
//------------------------------------------------------------------------------
   if (strcmp(cmd, "vehinfo", true) == 0)
   {//-------------------------------------------------------------------------
       if (IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] != 0)
      {//---------------------------------------------------------------------
         if (IsPlayerInAnyVehicle(playerid))
         {//-----------------------------------------------------------------
             new Float:health;
             new Float:xX, Float:yY, Float:zZ;
             GetPlayerPos(playerid, xX, yY, zZ);
             GetVehicleHealth(GetPlayerVehicleID(playerid), health);
             
            SendClientMessage(playerid, COLOR_RED,"-----------------------------------------");
            format(str, sizeof(str), " Vehicle Name: [%s]", GetVehicleName(GetPlayerVehicleID(playerid)));
            SendClientMessage(playerid, COLOR_GREEN, str);
               format(str, sizeof(str), " Vehicle   ID: [%d]", GetPlayerVehicleID(playerid));
               SendClientMessage(playerid, COLOR_GREEN, str);
             format(str, sizeof(str), " Model     ID: [%d]", GetVehicleModelFix(GetPlayerVehicleID(playerid)));
            SendClientMessage(playerid, COLOR_GREEN, str);
            format(str, sizeof(str), " Veh   Health: [%.1f]", health);
               SendClientMessage(playerid, COLOR_GREEN, str);
            format(str, sizeof(str), " Position: PosX: [%.1f]  PosY: [%.1f]  PosZ: [%.1f]", xX, yY, zZ);
               SendClientMessage(playerid, COLOR_GREEN, str);
            SendClientMessage(playerid, COLOR_RED,"-----------------------------------------");
         }//-----------------------------------------------------------------
         else
         {//-----------------------------------------------------------------
            SendClientMessage(playerid, COLOR_RED, "You are not in Vehicle");
         }//-----------------------------------------------------------------
      }//---------------------------------------------------------------------
      else
      {//---------------------------------------------------------------------
         SendClientMessage(playerid, COLOR_RED, "SERVER: Error! Unknow command!");
      }//---------------------------------------------------------------------
      return 1;
   }//-------------------------------------------------------------------------
//------------------------------------------------------------------------------
[/pawn]


Russian Сommunity

Вступайте в группу: vk.com/vicecitymultiplayer

My profile on sa-mp.com

Offline [Saint]

  • Made Man
  • ***
  • Posts: 126
  • Pawn scripting for SA:MP and VC:MP
    • View Profile
    • vk.com/vicecitymultiplayer
screenshot's  :)







Russian Сommunity

Вступайте в группу: vk.com/vicecitymultiplayer

My profile on sa-mp.com

Offline NeskWriter

  • Crime Boss
  • ****
  • Posts: 355
    • View Profile
nice one ;)


-Funniest quotes-

Quote from: asad3man
i cant able to understand

Offline heekz.shadow

  • LU testers
  • Made Man
  • *
  • Posts: 249
    • View Profile
delete
Quote
PlayerInfo[playerid][pAdmin] != 0
because not everyone has that..
Code: [Select]
[20:23] <habi> later only i heard that lu chatbox is customizable. On my first visit, it appeared ugly.
[20:23] <habi> May be that also be the reason why lu has no players

Offline [KB]ViceMania

  • Wiseguy
  • **
  • Posts: 53
  • Mega War server administrator
    • View Profile
so car hp this is nice :)  8)

Offline [Saint]

  • Made Man
  • ***
  • Posts: 126
  • Pawn scripting for SA:MP and VC:MP
    • View Profile
    • vk.com/vicecitymultiplayer
thanks  :)


Russian Сommunity

Вступайте в группу: vk.com/vicecitymultiplayer

My profile on sa-mp.com

Offline dynavolt71

  • Crime Boss
  • ****
  • Posts: 371
    • View Profile
    • My Blog
Awesome
« Last Edit: January 19, 2013, 02:13:01 pm by dynavolt71 »
[PAWNO]Fix Error " Failed to set data for "" " - http://forum.vicecitymultiplayer.com/index.php?topic=5743.0



:'(