Szerző Téma: Kocsi ID átváltása (HIBA)  (Megtekintve 637 alkalommal)

Kocsi ID átváltása (HIBA)
« Dátum: 2012. július 22. - 10:28:15 »
0 Show voters
Helló azt szeretném kérdezni, hogy meg lehet-e oldani ebben a scriptben, hogy ha eladó kocsit etszek le, akkor ne változzon mindig át a kocsi ID-je, ha újraindítom a szerót.
PL.: ha leteszek vehetõ autónak egy sultant és /dl ben az id-je 230, ha resizem a szerót akkor a sultan id-je 1 es lessz, ez pedig bezavar a frakció kocsiknak :(
ha van megoldás megköszönném, ha leírnátok/kijavítanátok a scriptben
 
[code]//===========================Szekció: Includes==================================
#include <a_samp>
#include <utils>
//===========================Szekció: Szinek===============================
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREEN 0x33AA33AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_BLUE 0x2641FEAA
#define DIALOGID 9999
//===========================Szekció: Forwardok==================================
forward split(const strsrc[], strdest[][], delimiter);
forward LoadCar();
forward SaveCarCoords();
forward LoadComponents(vehicleid);
forward OnPropUpdate();
forward IsAnOwnableCar(vehicleid);
forward IsAtDealership(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward CarMods(vehicleid);
forward ProxDetectorS(Float:radi, playerid, targetid);
forward CarKeys(playerid);
forward SavePlayerData(playerid);
forward ini_GetKey( line[] );
forward ini_GetValue( line[] );
forward OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
new carsonserver = 212;
new OwnableCarOffer[MAX_PLAYERS];
new OwnableCarID[MAX_PLAYERS];
new OwnableCarPrice[MAX_PLAYERS];
new vehName[][] = {
\"Landstalker\",
\"Bravura\",
\"Buffalo\",
\"Linerunner\",
\"Perrenial\",
\"Sentinel\",
\"Dumper\",
\"Firetruck\",
\"Trashmaster\",
\"Stretch\",
\"Manana\",
\"Infernus\",
\"Voodoo\",
\"Pony\",
\"Mule\",
\"Cheetah\",
\"Ambulance\",
\"Leviathan\",
\"Moonbeam\",
\"Esperanto\",
\"Taxi\",
\"Washington\",
\"Bobcat\",
\"Whoopee\",
\"BF Injection\",
\"Hunter\",
\"Premier\",
\"Enforcer\",
\"Securicar\",
\"Banshee\",
\"Predator\",
\"Bus\",
\"Rhino\",
\"Barracks\",
\"Hotknife\",
\"Trailer\",
\"Previon\",
\"Coach\",
\"Cabbie\",
\"Stallion\",
\"Rumpo\",
\"RC Bandit\",
\"Romero\",
\"Packer\",
\"Monster\",
\"Admiral\",
\"Squalo\",
\"Seasparrow\",
\"Pizzaboy\",
\"Tram\",
\"Trailer\",
\"Turismo\",
\"Speeder\",
\"Reefer\",
\"Tropic\",
\"Flatbed\",
\"Yankee\",
\"Caddy\",
\"Solair\",
\"Berkley\'s RC Van\",
\"Skimmer\",
\"PCJ-600\",
\"Faggio\",
\"Freeway\",
\"RC Baron\",
\"RC Raider\",
\"Glendale\",
\"Oceanic\",
\"Sanchez\",
\"Sparrow\",
\"Patriot\",
\"ATV\",
\"Coastguard\",
\"Dinghy\",
\"Hermes\",
\"Sabre\",
\"Rustler\",
\"ZR-350\",
\"Walton\",
\"Regina\",
\"Comet\",
\"BMX\",
\"Burrito\",
\"Camper\",
\"Marquis\",
\"Baggage\",
\"Dozer\",
\"Maverick\",
\"News Chopper\",
\"Rancher\",
\"FBI Rancher\",
\"Virgo\",
\"Greenwood\",
\"Jetmax\",
\"Hotring\",
\"Sandking\",
\"Blista Compact\",
\"Police Maverick\",
\"Boxvillde\",
\"Benson\",
\"Mesa\",
\"RC Goblin\",
\"Hotring Racer A\",
\"Hotring Racer B\",
\"Bloodring Banger\",
\"Rancher\",
\"Super GT\",
\"Elegant\",
\"Journey\",
\"Bike\",
\"Mountain Bike\",
\"Beagle\",
\"Cropduster\",
\"Stunt\",
\"Tanker\",
\"Roadtrain\",
\"Nebula\",
\"Majestic\",
\"Buccaneer\",
\"Shamal\",
\"Hydra\",
\"FCR-900\",
\"NRG-500\",
\"HPV1000\",
\"Cement Truck\",
\"Tow Truck\",
\"Fortune\",
\"Cadrona\",
\"FBI Truck\",
\"Willard\",
\"Forklift\",
\"Tractor\",
\"Combine\",
\"Feltzer\",
\"Remington\",
\"Slamvan\",
\"Blade\",
\"Freight\",
\"Streak\",
\"Vortex\",
\"Vincent\",
\"Bullet\",
\"Clover\",
\"Sadler\",
\"Firetruck\",
\"Hustler\",
\"Intruder\",
\"Primo\",
\"Cargobob\",
\"Tampa\",
\"Sunrise\",
\"Merit\",
\"Utility\",
\"Nevada\",
\"Jeep\",
\"Windsor\",
\"Monster\",
\"Monster\",
\"Uranus\",
\"Jester\",
\"Sultan\",
\"Stratum\",
\"Elegy\",
\"Raindance\",
\"RC Tiger\",
\"Flash\",
\"Tahoma\",
\"Savanna\",
\"Bandito\",
\"Freight Flat\",
\"Streak Carriage\",
\"Kart\",
\"Mower\",
\"Dune\",
\"Sweeper\",
\"Broadway\",
\"Tornado\",
\"AT-400\",
\"DFT-30\",
\"Huntley\",
\"Stafford\",
\"BF-400\",
\"News Van\",
\"Tug\",
\"Trailer\",
\"Emperor\",
\"Wayfarer\",
\"Euros\",
\"Hotdog\",
\"Club\",
\"Freight Box\",
\"Trailer\",
\"Andromada\",
\"Dodo\",
\"RC Cam\",
\"Launch\",
\"Police Car LSPD\",
\"Police Car SFPD\",
\"Police Car LVPD\",
\"Police Ranger\",
\"Picador\",
\"S.W.A.T\",
\"Alpha\",
\"Phoenix\",
\"Glendale\",
\"Sadler\",
\"Luggage\",
\"Luggage\",
\"Stairs\",
\"Boxville\",
\"Tiller\",
\"Utility Trailer\"
};
//===========================Section: Variables=================================
enum pInfo
{
pPcarkey,
pPcarkey2,
pPcarkey3,
}
new PlayerInfo[256][pInfo];
enum cInfo
{
cModel,
Float:cLocationx,
Float:cLocationy,
Float:cLocationz,
Float:cAngle,
cColorOne,
cColorTwo,
cOwner[MAX_PLAYER_NAME],
cDescription[12],
cValue,
cLicense[14],
cRegistration,
cOwned,
cLock,
mod1,
mod2,
mod3,
mod4,
mod5,
mod6,
mod7,
mod8,
mod9,
mod10,
mod11,
mod12,
mod13,
mod14,
mod15,
mod16,
mod17,
paintjob,
};
new CarInfo[1000][cInfo];
new spoiler[20][0] = {
{1000},
{1001},
{1002},
{1003},
{1014},
{1015},
{1016},
{1023},
{1058},
{1060},
{1049},
{1050},
{1138},
{1139},
{1146},
{1147},
{1158},
{1162},
{1163},
{1164}
};
new nitro[3][0] = {
    {1008},
    {1009},
    {1010}
};
new fbumper[23][0] = {
    {1117},
    {1152},
    {1153},
    {1155},
    {1157},
    {1160},
    {1165},
    {1167},
    {1169},
    {1170},
    {1171},
    {1172},
    {1173},
    {1174},
    {1175},
    {1179},
    {1181},
    {1182},
    {1185},
    {1188},
    {1189},
    {1192},
    {1193}
};
new rbumper[22][0] = {
    {1140},
    {1141},
    {1148},
    {1149},
    {1150},
    {1151},
    {1154},
    {1156},
    {1159},
    {1161},
    {1166},
    {1168},
    {1176},
    {1177},
    {1178},
    {1180},
    {1183},
    {1184},
    {1186},
    {1187},
    {1190},
    {1191}
};
new exhaust[28][0] = {
    {1018},
    {1019},
    {1020},
    {1021},
    {1022},
    {1028},
    {1029},
    {1037},
    {1043},
    {1044},
    {1045},
    {1046},
    {1059},
    {1064},
    {1065},
    {1066},
    {1089},
    {1092},
    {1104},
    {1105},
    {1113},
    {1114},
    {1126},
    {1127},
    {1129},
    {1132},
    {1135},
    {1136}
};
new bventr[2][0] = {
    {1042},
    {1044}
};
new bventl[2][0] = {
    {1043},
    {1045}
};
new bscoop[4][0] = {
{1004},
{1005},
{1011},
{1012}
};
new rscoop[13][0] = {
    {1006},
    {1032},
    {1033},
    {1035},
    {1038},
    {1053},
    {1054},
    {1055},
    {1061},
    {1067},
    {1068},
    {1088},
    {1091}
};
new lskirt[21][0] = {
    {1007},
    {1026},
    {1031},
    {1036},
    {1039},
    {1042},
    {1047},
    {1048},
    {1056},
    {1057},
    {1069},
    {1070},
    {1090},
    {1093},
    {1106},
    {1108},
    {1118},
    {1119},
    {1133},
    {1122},
    {1134}
};
new rskirt[21][0] = {
    {1017},
    {1027},
    {1030},
    {1040},
    {1041},
    {1051},
    {1052},
    {1062},
    {1063},
    {1071},
    {1072},
    {1094},
    {1095},
    {1099},
    {1101},
    {1102},
    {1107},
    {1120},
    {1121},
    {1124},
    {1137}
};
new hydraulics[1][0] = {
    {1087}
};
new base[1][0] = {
    {1086}
};
new rbbars[2][0] = {
    {1109},
    {1110}
};
new fbbars[2][0] = {
    {1115},
    {1116}
};
new wheels[17][0] = {
    {1025},
    {1073},
    {1074},
    {1075},
    {1076},
    {1077},
    {1078},
    {1079},
    {1080},
    {1081},
    {1082},
    {1083},
    {1084},
    {1085},
    {1096},
    {1097},
    {1098}
};
new light[2][0] = {
{1013},
{1024}
};
InitComponents(componentid)
{
new i;
for(i=0; i<20; i++)
{
    if(spoiler[0]==componentid) { return 1; }
}
for(i=0; i<3; i++)
{
    if(nitro[0]==componentid) { return 2; }
}
for(i=0; i<23; i++)
{
    if(fbumper[0]==componentid) { return 3; }
}
for(i=0; i<22; i++)
{
    if(rbumper[0]==componentid) { return 4; }
}
for(i=0; i<28; i++)
{
    if(exhaust[0]==componentid) { return 5; }
}
for(i=0; i<2; i++)
{
    if(bventr[0]==componentid) { return 6; }
}
for(i=0; i<2; i++)
{
    if(bventl[0]==componentid) { return 7; }
}
for(i=0; i<4; i++)
{
    if(bscoop[0]==componentid) { return 8; }
}
for(i=0; i<13; i++)
{
    if(rscoop[0]==componentid) { return 9; }
}
for(i=0; i<21; i++)
{
    if(lskirt[0]==componentid) { return 10; }
}
for(i=0; i<21; i++)
{
    if(rskirt[0]==componentid) { return 11; }
}
if(hydraulics[0][0]==componentid) { return 12; }
if(base[0][0]==componentid) { return 13; }
for(i=0; i<2; i++)
{
    if(rbbars[0]==componentid) { return 14; }
}
for(i=0; i<2; i++)
{
    if(fbbars[0]==componentid) { return 15; }
}
for(i=0; i<17; i++)
{
    if(wheels[0]==componentid) { return 16; }
}
for(i=0; i<2; i++)
{
    if(light[0]==componentid) { return 17; }
}
return 0;
}
//===========================Section: strtok & split============================
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= \' \'))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
    if(strsrc==delimiter || i==strlen(strsrc)){
        len = strmid(strdest[aNum], strsrc, li, i, 128);
        strdest[aNum][len] = 0;
        li = i+1;
        aNum++;
}
i++;
}
return 1;
}
//===========================Section: Callbacks & Functions=====================
public OnFilterScriptInit()
{
printf(\"Filterscript carownership.amx Initiated\\n\");
LoadCar();
for(new h = carsonserver; h < sizeof(CarInfo); h++)
{
AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);
LoadComponents(h);
}
return 1;
}
public OnFilterScriptExit() { return 1; }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new carid = GetPlayerVehicleID(playerid);
    if ((newkeys & KEY_SECONDARY_ATTACK))
{
    if(IsAnOwnableCar(carid) && CarInfo[carid][cOwned] == 0)
      {
        TogglePlayerControllable(playerid, 1);
        RemovePlayerFromVehicle(playerid);
    }
}
return 1;
}
public SavePlayerData(playerid)
{
if(IsPlayerConnected(playerid))
{
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), \"carkeys/%s.ini\", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
   new var[32];
   format(var, 32, \"CarKey=%d\\n\",PlayerInfo[playerid][pPcarkey]);fwrite(hFile, var);
   format(var, 32, \"CarKey2=%d\\n\",PlayerInfo[playerid][pPcarkey2]);fwrite(hFile, var);
   format(var, 32, \"CarKey3=%d\\n\",PlayerInfo[playerid][pPcarkey3]);fwrite(hFile, var);
   fclose(hFile);
}
}
return 1;
}
public ProxDetectorS(Float:radi, playerid, targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
//radi = 2.0; //Trigger Radius
GetPlayerPos(targetid, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
//printf(\"DEBUG: X:%f Y:%f Z:%f\",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
   return 1;
}
}
return 0;
}
public CarKeys(playerid)
{
    new string2[64];
new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), \"carkeys/%s.ini\", playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
   key = ini_GetKey( Data );
   if( strcmp( key , \"CarKey\" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPcarkey] = strval( val ); }
   if( strcmp( key , \"CarKey2\" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPcarkey2] = strval( val ); }
   if( strcmp( key , \"CarKey3\" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPcarkey3] = strval( val ); }
        }
        fclose(UserFile);
        SendClientMessage(playerid, COLOR_WHITE,\"Syber RPG : Jármû kulcsok betöltve!\");
}
return 1;
}
public CarMods(vehicleid)
{
    if(CarInfo[vehicleid][paintjob] > -1 || CarInfo[vehicleid][mod1] > 0 || CarInfo[vehicleid][mod2] > 0 || CarInfo[vehicleid][mod3] > 0 || CarInfo[vehicleid][mod4] > 0 || CarInfo[vehicleid][mod5] > 0 || CarInfo[vehicleid][mod6] > 0 || CarInfo[vehicleid][mod7] > 0 || CarInfo[vehicleid][mod8] > 0)
{
    return 1;
}
else if (CarInfo[vehicleid][mod9] > 0 || CarInfo[vehicleid][mod10] > 0 || CarInfo[vehicleid][mod11] > 0 || CarInfo[vehicleid][mod12] > 0|| CarInfo[vehicleid][mod13] > 0|| CarInfo[vehicleid][mod14] > 0|| CarInfo[vehicleid][mod15] > 0|| CarInfo[vehicleid][mod16] > 0|| CarInfo[vehicleid][mod17] > 0)
{
   return 1;
}
return 0;
}
public IsAtDealership(playerid)
{
if(IsPlayerConnected(playerid))
{
    if(PlayerToPoint(25.0,playerid,2128.0864,-1135.3912,25.5855) || PlayerToPoint(50,playerid,537.3366,-1293.2140,17.2422) || PlayerToPoint(35,playerid,2521.5544,-1524.4504,23.8365) || PlayerToPoint(50,playerid,2155.0146,-1177.3333,23.8211) || PlayerToPoint(50,playerid,299.1723,-1518.6627,24.6007) || PlayerToPoint(99,playerid,1938.414428,-2643.810058,13.723393))
{
   return 1;
}
}
return 0;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
   return 1;
}
}
return 0;
}
public OnVehicleMod(playerid,vehicleid,componentid)
{
new mods = InitComponents(componentid);
if(IsPlayerInVehicle(playerid, vehicleid))
{
switch(mods)
{
   case 1: { CarInfo[vehicleid][mod1] = componentid; }
   case 2: { CarInfo[vehicleid][mod2] = componentid; }
   case 3: { CarInfo[vehicleid][mod3] = componentid; }
   case 4: { CarInfo[vehicleid][mod4] = componentid; }
   case 5: { CarInfo[vehicleid][mod5] = componentid; }
   case 6: { CarInfo[vehicleid][mod6] = componentid; }
   case 7: { CarInfo[vehicleid][mod7] = componentid; }
   case 8: { CarInfo[vehicleid][mod8] = componentid; }
   case 9: { CarInfo[vehicleid][mod9] = componentid; }
   case 10: { CarInfo[vehicleid][mod10] = componentid; }
   case 11: { CarInfo[vehicleid][mod11] = componentid; }
   case 12: { CarInfo[vehicleid][mod12] = componentid; }
   case 13: { CarInfo[vehicleid][mod13] = componentid; }
   case 14: { CarInfo[vehicleid][mod14] = componentid; }
   case 15: { CarInfo[vehicleid][mod15] = componentid; }
   case 16: { CarInfo[vehicleid][mod16] = componentid; }
   case 17: { CarInfo[vehicleid][mod17] = componentid; }
}
}
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
if(IsPlayerInVehicle(playerid, vehicleid))
{
    if(GetVehicleModel(vehicleid) == 483)
    {
   switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
       }
        }
        if(GetVehicleModel(vehicleid) == 534)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 535)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 536)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 558)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 559)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 560)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 561)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 562)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 565)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 567)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
        if(GetVehicleModel(vehicleid) == 575)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
       }
        }
        if(GetVehicleModel(vehicleid) == 576)
    {
         switch(paintjobid)
   {
          case 0: CarInfo[vehicleid][paintjob] = 0;
          case 1: CarInfo[vehicleid][paintjob] = 1;
          case 2: CarInfo[vehicleid][paintjob] = 2;
       }
        }
}
return 1;
}
public OnPropUpdate()
{
new idx;
new File: file2;
idx = carsonserver;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), \"%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\\n\",
CarInfo[idx][cModel],
CarInfo[idx][cLocationx],
CarInfo[idx][cLocationy],
CarInfo[idx][cLocationz],
CarInfo[idx][cAngle],
CarInfo[idx][cColorOne],
CarInfo[idx][cColorTwo],
CarInfo[idx][cOwner],
CarInfo[idx][cDescription],
CarInfo[idx][cValue],
CarInfo[idx][cLicense],
CarInfo[idx][cOwned],
CarInfo[idx][cLock],
CarInfo[idx][mod1],
CarInfo[idx][mod2],
CarInfo[idx][mod3],
CarInfo[idx][mod4],
CarInfo[idx][mod5],
CarInfo[idx][mod6],
CarInfo[idx][mod7],
CarInfo[idx][mod8],
CarInfo[idx][mod9],
CarInfo[idx][mod10],
CarInfo[idx][mod11],
CarInfo[idx][mod12],
CarInfo[idx][mod13],
CarInfo[idx][mod14],
CarInfo[idx][mod15],
CarInfo[idx][mod16],
CarInfo[idx][mod17],
CarInfo[idx][paintjob]);
if(idx == carsonserver)
{
   file2 = fopen(\"masini.cfg\", io_write);
}
else
{
   file2 = fopen(\"masini.cfg\", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
public IsAnOwnableCar(vehicleid)
{
if(vehicleid >= carsonserver && vehicleid <= 1000) { return 1; }
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new vehid;
vehid = GetPlayerVehicleID(playerid);
    if(response)
{
if(dialogid == DIALOGID+2)
{
   if(response)
   {
      if(listitem==0)
      {
         if(CarInfo[vehid][mod1] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod1] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Eleronul a fost scos cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Eleron Instalat!!!\");
         }
      }
      if(listitem==1)
      {
         if(CarInfo[vehid][mod3] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ,Float:CarHP,Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod3] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Spoilerul din fata a fost scos cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Spoilerul din fata Instalat!!!\");
         }
      }
      if(listitem==2)
      {
         if(CarInfo[vehid][mod4] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod4] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Spoilerul din spate a fost scos cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Spoilerul din spate Instalat!!!\");
         }
      }
      if(listitem==3)
      {
         if(CarInfo[vehid][mod10] > 0 && CarInfo[vehid][mod11] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod11] = 0; CarInfo[vehid][mod10] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Lateralele au fost scoase cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Laterale Instalate!!!\");
         }
      }
      if(listitem==4)
      {
         if(CarInfo[vehid][mod9] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod9] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Roof Scoops au fost scoase cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Roof Scoops Instalat!!!\");
         }
      }
      if(listitem==5)
      {
         if(CarInfo[vehid][mod5] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod5] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Tobele de Esapament au fost scoase cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Tobe de Esapament Instalate!!!\");
         }
      }
      if(listitem==6)
      {
         if(CarInfo[vehid][mod2] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod2] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Nitro a fost scos cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Nitro Instalat!!!\");
         }
      }
      if(listitem==7)
      {
         if(CarInfo[vehid][mod12] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod12] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Hidraulica a fost scoasa cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Hidraulica Instalata!!!\");
         }
      }
      if(listitem==8)
      {
         if(CarInfo[vehid][mod16] > 0)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][mod16] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Rotile au fost scoase cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Roti Instalate!!!\");
         }
      }
      if(listitem==9)
      {
         if(CarInfo[vehid][paintjob] > -1)
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][paintjob] = -1;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Tatuajul a fost indepartat cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu are Tatuaj!!!\");
         }
      }
      if(listitem==10)
      {
         if(CarMods(vehid))
         {
                        new Float:XX,Float:YY,Float:ZZ; new Float:CarHP, Float:OldCarHP; new panels,doors,lights,tires;
                        GetVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    GetVehicleHealth(vehid, CarHP); OldCarHP = CarHP;
                    GetVehiclePos(vehid,XX,YY,ZZ); CarInfo[vehid][paintjob] = -1; CarInfo[vehid][mod1] = 0; CarInfo[vehid][mod2] = 0;
                    CarInfo[vehid][mod3] = 0; CarInfo[vehid][mod4] = 0; CarInfo[vehid][mod5] = 0; CarInfo[vehid][mod6] = 0; CarInfo[vehid][mod7] = 0;
                    CarInfo[vehid][mod8] = 0; CarInfo[vehid][mod9] = 0; CarInfo[vehid][mod10] = 0; CarInfo[vehid][mod11] = 0; CarInfo[vehid][mod12] = 0;
                    CarInfo[vehid][mod13] = 0; CarInfo[vehid][mod14] = 0; CarInfo[vehid][mod15] = 0; CarInfo[vehid][mod16] = 0; CarInfo[vehid][mod17] = 0;
                    SetVehicleToRespawn(vehid); SetVehiclePos(vehid,XX,YY,ZZ);
                    PutPlayerInVehicle(playerid,vehid,0); SetVehicleHealth(vehid, OldCarHP);
                    UpdateVehicleDamageStatus(vehid,panels,doors,lights,tires);
                    SendClientMessage(playerid, COLOR_BLUE,\"*  Tuningul a fost indepartat cu succes!!!\");
                        LoadComponents(vehid); OnPropUpdate(); SavePlayerData(playerid);
         }
         else
         {
            SendClientMessage(playerid, COLOR_WHITE,\"*  Masina ta nu este Tunata!!!\");
         }
      }
        }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_WHITE,\"* Dialog has been hidden\");
    }
    return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(IsAnOwnableCar(vehicleid) && CarInfo[vehicleid][cLock] == 1 && CarInfo[vehicleid][cOwned] == 1)
{
if(IsPlayerAdmin(playerid)) { }
else
{
   new Float:cx, Float:cy, Float:cz;
           GetPlayerPos(playerid, cx, cy, cz);
          SetPlayerPos(playerid, cx, cy, cz);
}
}
return 1;
}
public OnVehicleSpawn(vehicleid)
{
    LoadComponents(vehicleid);
    return 1;
}
public LoadComponents(vehicleid)
{
if(CarInfo[vehicleid][cOwned] == 1)
{
        if(CarInfo[vehicleid][mod1] >= 1000 && CarInfo[vehicleid][mod1] <= 1193)
    {
            if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod1])) != CarInfo[vehicleid][mod1]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod1]); }
        }
    if(CarInfo[vehicleid][mod2] >= 1000 && CarInfo[vehicleid][mod2] <= 1193)
    {
        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod2])) != CarInfo[vehicleid][mod2]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod2]); }
    }
    if(CarInfo[vehicleid][mod3] >= 1000 && CarInfo[vehicleid][mod3] <= 1193)
    {
        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod3])) != CarInfo[vehicleid][mod3]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod3]); }
    }
    if(CarInfo[vehicleid][mod4] >= 1000 && CarInfo[vehicleid][mod4] <= 1193)
    {
        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod4])) != CarInfo[vehicleid][mod4]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod4]); }
    }
    if(CarInfo[vehicleid][mod5] >= 1000 && CarInfo[vehicleid][mod5] <= 1193)
    {
        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod5])) != CarInfo[vehicleid][mod5]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod5]); }
    }
    if(CarInfo[vehicleid][mod6] >= 1000 && CarInfo[vehicleid][mod6] <= 1193)
    {
        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod6])) != CarInfo[vehicleid][mod6]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod6]); }
    }
    if(CarInfo[vehicleid][mod7] >= 1000 && CarInfo[vehicleid][mod7] <= 1193)
    {
        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod7])) != CarInfo[vehicleid][mod7]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod7]); }
    }
    if(CarInfo[vehicleid][mod8] >= 1000 && CarInfo[vehicleid][mod8] <= 1193)
       {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod8])) != CarInfo[vehicleid][mod8]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod8]); }
       }
       if(CarInfo[vehicleid][mod9] >= 1000 && CarInfo[vehicleid][mod9] <= 1193)
    {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod9])) != CarInfo[vehicleid][mod9]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod9]); }
       }
       if(CarInfo[vehicleid][mod10] >= 1000 && CarInfo[vehicleid][mod10] <= 1193)
       {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod10])) != CarInfo[vehicleid][mod10]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod10]); }
       }
       if(CarInfo[vehicleid][mod11] >= 1000 && CarInfo[vehicleid][mod11] <= 1193)
       {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod11])) != CarInfo[vehicleid][mod11]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod11]); }
       }
       if(CarInfo[vehicleid][mod12] >= 1000 && CarInfo[vehicleid][mod12] <= 1193)
       {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod12])) != CarInfo[vehicleid][mod12]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod12]); }
       }
       if(CarInfo[vehicleid][mod13] >= 1000 && CarInfo[vehicleid][mod13] <= 1193)
       {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod13])) != CarInfo[vehicleid][mod13]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod13]); }
       }
       if(CarInfo[vehicleid][mod14] >= 1000 && CarInfo[vehicleid][mod14] <= 1193)
       {
        if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod14])) != CarInfo[vehicleid][mod14]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod14]); }
       }
       if(CarInfo[vehicleid][mod15] >= 1000 && CarInfo[vehicleid][mod15] <= 1193)
       {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod15])) != CarInfo[vehicleid][mod15]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod15]); }
       }
       if(CarInfo[vehicleid][mod16] >= 1000 && CarInfo[vehicleid][mod16] <= 1193)
       {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod16])) != CarInfo[vehicleid][mod16]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod16]); }
       }
       if(CarInfo[vehicleid][mod17] >= 1000 && CarInfo[vehicleid][mod17] <= 1193)
       {
           if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(CarInfo[vehicleid][mod17])) != CarInfo[vehicleid][mod17]) { AddVehicleComponent(vehicleid,CarInfo[vehicleid][mod17]); }
    }
        if(CarInfo[vehicleid][paintjob] > -1) { ChangeVehiclePaintjob(vehicleid,CarInfo[vehicleid][paintjob]); ChangeVehicleColor(vehicleid, 1, 1); }
        else { ChangeVehicleColor(vehicleid, CarInfo[vehicleid][cColorOne], CarInfo[vehicleid][cColorTwo]); }
        if(CarInfo[vehicleid][cLicense] > 0) { SetVehicleNumberPlate(vehicleid,CarInfo[vehicleid][cLicense]); }
    }
    else
    {
        if(CarInfo[vehicleid][cLicense] > 0) { SetVehicleNumberPlate(vehicleid,CarInfo[vehicleid][cLicense]); }
    }
    return 1;
}
public OnPlayerSpawn(playerid)
{
CarKeys(playerid);
return 1;
}
public OnPlayerConnect(playerid)
{
    PlayerInfo[playerid][pPcarkey] = -1;
PlayerInfo[playerid][pPcarkey2] = -1;
PlayerInfo[playerid][pPcarkey3] = -1;
for(new h = carsonserver; h < sizeof(CarInfo); h++)
{
SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new string[256];
new cmd[256];
new tmp[256];
new sendername[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new giveplayerid;
new idcar = GetPlayerVehicleID(playerid);
cmd = strtok(cmdtext, idx);
new vehid;
vehid = GetPlayerVehicleID(playerid);
if(strcmp(cmd,\"/cancel\",true)==0)
    {
        if(IsPlayerConnected(playerid))
    {
   new x_job[256];
   x_job = strtok(cmdtext, idx);
   if(!strlen(x_job)) { return 1; }
   if(strcmp(x_job,\"ownablecar\",true) == 0) { OwnableCarOffer[playerid] = 999; OwnableCarID[playerid] = 0; OwnableCarPrice[playerid] = 0; }
   else { return 1; }
   format(string, sizeof(string), \"* Syber RPG : Visszavontad : %s-t ajánlatát.\", x_job);
   SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
if(strcmp(cmd,\"/accept\",true)==0)
    {
        if(IsPlayerConnected(playerid))
    {
   new x_job[256];
   x_job = strtok(cmdtext, idx);
   if(!strlen(x_job)) { return 1; }
   if(strcmp(x_job,\"ownablecar\",true) == 0)
   {
       if(OwnableCarOffer[playerid] < 999)
       {
           if(OwnableCarID[playerid] == 0) { return 1; }
           if(OwnableCarPrice[playerid] == 0 || OwnableCarPrice[playerid] > 10000000) { return 1; } //Max ára 10,000,000Ft
           if(OwnableCarID[playerid] == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey]) { }
           else if(OwnableCarID[playerid] == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2]) { }
           else if(OwnableCarID[playerid] == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3]) { }
           else { SendClientMessage(playerid, COLOR_GREY, \" Syber RPG: Ez túl sok...\"); return 1; }
           if(GetPlayerMoney(playerid) >= OwnableCarPrice[playerid])
           {
            if(IsPlayerConnected(OwnableCarOffer[playerid]))
            {
                GetPlayerName(OwnableCarOffer[playerid], giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(PlayerInfo[playerid][pPcarkey] == -1)
               {
                  if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey])
                  {
                     PlayerInfo[playerid][pPcarkey] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey] = -1;
                  }
                  else if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2])
                  {
                     PlayerInfo[playerid][pPcarkey] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2] = -1;
                  }
                  else if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3])
                  {
                     PlayerInfo[playerid][pPcarkey] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3] = -1;
                  }
                  else
                  {
                      SendClientMessage(playerid, COLOR_GREY, \"  Syber RPG: Autókereskedõnek szüksége van az autóra... !\");
                     return 1;
                  }
                  format(string, sizeof(string), \"*Syber RPG: Vettél egy jármûvet %dFt-ért , %s-tõl.\",OwnableCarPrice[playerid],giveplayer);
                  SendClientMessage(playerid, COLOR_WHITE, string);
                  format(string, sizeof(string), \"*Syber RPG: %s megvásárolta tõled az autót %dFt-ért.\",sendername,OwnableCarPrice[playerid]);
                  SendClientMessage(OwnableCarOffer[playerid], COLOR_WHITE, string);
                   RemovePlayerFromVehicle(OwnableCarOffer[playerid]);
                   GivePlayerMoney(playerid, - OwnableCarPrice[playerid]);
                   GivePlayerMoney(OwnableCarOffer[playerid], OwnableCarPrice[playerid]);
                   strmid(CarInfo[OwnableCarID[playerid]][cOwner], sendername, 0, strlen(sendername), 999);
               }
                else if(PlayerInfo[playerid][pPcarkey2] == -1)
               {
                   if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey])
                  {
                     PlayerInfo[playerid][pPcarkey2] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey] = -1;
                  }
                  else if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2])
                  {
                     PlayerInfo[playerid][pPcarkey2] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2] = -1;
                  }
                  else if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3])
                  {
                     PlayerInfo[playerid][pPcarkey2] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3] = -1;
                  }
                  else
                  {
                      SendClientMessage(playerid, COLOR_GREY, \"  Syber RPG: Autókereskedõnek szüksége van egy autóra !\");
                     return 1;
                  }
                  format(string, sizeof(string), \"* Syber RPG: Vettél egy jármûvet %dFt-ért, %s-tõl.\",OwnableCarPrice[playerid],giveplayer);
                  SendClientMessage(playerid, COLOR_WHITE, string);
                  format(string, sizeof(string), \"* Syber RPG: %s megvásárolta tõled az autót %dFt-ért.\",sendername,OwnableCarPrice[playerid]);
                  SendClientMessage(OwnableCarOffer[playerid], COLOR_WHITE, string);
                   RemovePlayerFromVehicle(OwnableCarOffer[playerid]);
                   GivePlayerMoney(playerid, - OwnableCarPrice[playerid]);
                   GivePlayerMoney(OwnableCarOffer[playerid], OwnableCarPrice[playerid]);
                   strmid(CarInfo[OwnableCarID[playerid]][cOwner], sendername, 0, strlen(sendername), 999);
               }
                else if(PlayerInfo[playerid][pPcarkey3] == -1)
               {
                   if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey])
                  {
                     PlayerInfo[playerid][pPcarkey3] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey] = -1;
                  }
                  else if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2])
                  {
                     PlayerInfo[playerid][pPcarkey3] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey2] = -1;
                  }
                  else if(GetPlayerVehicleID(OwnableCarOffer[playerid]) == PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3])
                  {
                     PlayerInfo[playerid][pPcarkey3] = PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3];
                      PlayerInfo[OwnableCarOffer[playerid]][pPcarkey3] = -1;
                  }
                  el
« Utoljára szerkesztve: 2012. július 22. - 11:37:26 írta Adam_McGoldy »

Nem elérhető IXT

  • 2502
  • Steph Curry
    • Profil megtekintése
Kocsi ID átváltása (HIBA)
« Válasz #1 Dátum: 2012. július 22. - 11:26:19 »
0 Show voters
Hali! Kérlek tedd [ code] [ / code] tagba, vagy [ code=pawn] [ / code] kódba.

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal