cand dau click acolo mi se deschide un fisier si imi scrie urmatoarele: #include #include /* ~~~ Version 1.4 ~~~ Hint: If you want to use the /resetcars function, which resets the demonstration cars' position, you have to implement the public function IsAdmin(playerid) in your gamemode. It has to return 1 if the player is an admin or 0 if not. Copyright 2009 by ping (Marcel Kinzel) Credits to Tratulla for his 2 .ini Functions. Special Thanks to the Wiki info by Ignas1337 for the Tuning extension and the SA-MP's strtok() function. */ // comment out if you do not want to use the /resetcars function #define RESETCARS // comment out if you do not want to use the /pcarsell function #define CARSELL #if defined CARSELL #include #endif #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_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_RED 0xAA3333AA #define COLOR_LIGHTRED 0xFF6347AA #define COLOR_LIGHTBLUE 0x33CCFFAA #define COLOR_LIGHTGREEN 0x9ACD32AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_YELLOW2 0xF5DEB3AA #define COLOR_WHITE 0xFFFFFFAA forward SetVehicleParamsForAll(carid,objective,doorslocked); forward CreateTunedCar(playerid); forward DelayDestroyCar(playerid); forward DelaySetVehicleParams(playerid); forward ResetAutohausSpawns(); enum ahCar { Typ, Float:X, Float:Y, Float:Z, Float:Rotation, Status, Lock, Carid, Paintjob, Color1, Color2, mod1, mod2, mod3, mod4, mod5, mod6, mod7, mod8, mod9, mod10, mod11, mod12, mod13, mod14, mod15, mod16, mod17, }; new Carlist[MAX_PLAYERS][ahCar]; enum ahSpawn { Float:X, Float:Y, Float:Z, Float:Rotation, }; new Carspawns[2][ahSpawn] = { {739.7457,-1343.8668,13.2828,270.2592}, {-1639.3599,1198.1665,6.9527,269.9673} }; enum ahModel { Name[128], Autohaus, Modelid, Carid, Price, Repair, Float:X, Float:Y, Float:Z, Float:Rotation, }; new Buylist[34][ahModel] = { {"Stallion",0,439,-1,750000,5000,783.0,-1335.0,13.2,121.1}, {"Feltzer",0,533,-1,500000,3000,783.0,-1340.0,13.2,121.1}, {"Windsor",0,555,-1,450000,3400,783.0,-1345.0,13.2,121.1}, {"Blade",0,536,-1,350000,3000,783.0,-1350.0,13.2,121.1}, {"Remington",0,534,-1,500000,3000,783.0,-1355.0,13.2,121.1}, {"Savanna",0,567,-1,350000,3000,783.0,-1360.0,13.2,121.1}, {"Slamvan",0,535,-1,500000,3000,783.0,-1365.0,13.2,121.1}, {"Voodoo",0,412,-1,500000,3000,783.0,-1370.0,13.2,121.1}, {"Huntley",0,579,-1,200000,1000,783.0,-1375.0,13.2,121.1}, {"Buccaneer",0,518,-1,120000,1000,783.0,-1380.0,13.2,121.1}, {"Clover",0,542,-1,35000,500,765.0,-1360.0,13.4,301.1}, {"Elegant",0,507,-1,40000,650,765.0,-1365.0,13.4,301.1}, {"Elegy",0,562,-1,1500000,10000,765.0,-1370.0,13.4,301.1}, {"Esperanto",0,419,-1,65000,650,765.0,-1375.0,13.4,301.1}, {"Fortune",0,526,-1,35000,500,765.0,-1380.0,13.4,301.1}, {"Sultan",0,560,-1,1500000,10000,766.0,-1333.0,13.3,211.1}, {"Sunrise",0,550,-1,300000,2000,761.0,-1333.0,13.3,211.1}, {"Vincent",0,540,-1,280000,2000,756.0,-1333.0,13.3,211.1}, {"Alpha",0,602,-1,230000,2000,751.0,-1333.0,13.3,211.1}, {"Banshee",0,429,-1,1000000,5500,746.0,-1333.0,13.3,211.1}, {"Blista Compact",1,496,-1,350000,2500,-1668.6447,1207.0372,7.0249,309.5959}, {"Buffalo",1,402,-1,500000,3000,-1663.6709,1215.2883,7.0234,274.9868}, {"Bullet",1,541,-1,7500000,17500,-1651.3892,1210.3469,7.0208,281.3321}, {"Cheetah",1,415,-1,4000000,10000,-1677.3560,1207.8099,13.4461,208.2602}, {"Club",1,589,-1,70000,750,-1665.7789,1222.4406,13.4485,279.6459}, {"Euros",1,587,-1,650000,7000,-1660.7256,1217.6407,13.4444,283.1553}, {"Infernus",1,411,-1,1500000,7000,-1653.2462,1210.7842,13.4460,266.7211}, {"Jester",1,559,-1,1500000,10000,-1676.0128,1207.1641,20.9248,261.5029}, {"Phoenix",1,603,-1,600000,4000,-1664.4386,1206.8241,20.9289,332.5978}, {"Super GT",1,506,-1,12500000,20000,-1651.6372,1208.2538,20.9231,305.1015}, {"Turismo",1,451,-1,13000000,20000,-1665.1248,1222.7113,20.9265,267.4103}, {"Uranus",1,558,-1,850000,10000,-1661.1943,1217.9629,20.9268,286.1662}, {"ZR-350",1,477,-1,6500000,7000,-1654.3116,1214.8097,20.9267,173.5712}, {"Faggio",0,462,-1,10000,500,750.7272,-1358.3872,13.0996,273.7736} }; new Spectating[MAX_PLAYERS][1]; // begin of tuning component list 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 lights[2][0] = { {1013}, {1024} }; // end of tuning component list #if defined CARSELL new offerCar[MAX_PLAYERS][2]; #endif ini_GetKey( line[] ) { new keyRes[256]; keyRes[0] = 0; if ( strfind( line , "=" , true ) == -1 ) return keyRes; strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) ); return keyRes; } ini_GetValue( line[] ) { new valRes[256]; valRes[0]=0; if ( strfind( line , "=" , true ) == -1 ) return valRes; strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) ); return valRes; } 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; } IsAutohausCar(carid) { new i; for(i=0; i=offerCar[playerid][1]) { new sellerid=offerCar[playerid][0]; new price=offerCar[playerid][1]; offerCar[playerid]={-1,0}; GivePlayerMoney(playerid, - price); GivePlayerMoney(sellerid, price); Carlist[playerid][Typ]=Carlist[sellerid][Typ]; Carlist[playerid][X]=Carlist[sellerid][X]; Carlist[playerid][Y]=Carlist[sellerid][Y]; Carlist[playerid][Z]=Carlist[sellerid][Z]; Carlist[playerid][Rotation]=Carlist[sellerid][Rotation]; Carlist[playerid][status]=Carlist[sellerid][status]; Carlist[playerid][Lock]=Carlist[sellerid][Lock]; Carlist[playerid][Carid]=Carlist[sellerid][Carid]; Carlist[playerid][Color1]=Carlist[sellerid][Color1]; Carlist[playerid][Color2]=Carlist[sellerid][Color2]; Carlist[playerid][mod1]=Carlist[sellerid][mod1]; Carlist[playerid][mod2]=Carlist[sellerid][mod2]; Carlist[playerid][mod3]=Carlist[sellerid][mod3]; Carlist[playerid][mod4]=Carlist[sellerid][mod4]; Carlist[playerid][mod5]=Carlist[sellerid][mod5]; Carlist[playerid][mod6]=Carlist[sellerid][mod6]; Carlist[playerid][mod7]=Carlist[sellerid][mod7]; Carlist[playerid][mod8]=Carlist[sellerid][mod8]; Carlist[playerid][mod9]=Carlist[sellerid][mod9]; Carlist[playerid][mod10]=Carlist[sellerid][mod10]; Carlist[playerid][mod11]=Carlist[sellerid][mod11]; Carlist[playerid][mod12]=Carlist[sellerid][mod12]; Carlist[playerid][mod13]=Carlist[sellerid][mod13]; Carlist[playerid][mod14]=Carlist[sellerid][mod14]; Carlist[playerid][mod15]=Carlist[sellerid][mod15]; Carlist[playerid][mod16]=Carlist[sellerid][mod16]; Carlist[playerid][mod17]=Carlist[sellerid][mod17]; Carlist[playerid][Paintjob]=Carlist[sellerid][Paintjob]; Carlist[sellerid][Typ]=-1; Carlist[sellerid][X]=0.0; Carlist[sellerid][Y]=0.0; Carlist[sellerid][Z]=0.0; Carlist[sellerid][Rotation]=0.0; Carlist[sellerid][status]=0; Carlist[sellerid][Lock]=0; Carlist[sellerid][Carid]=-1; Carlist[sellerid][Color1]=-1; Carlist[sellerid][Color2]=-1; Carlist[sellerid][mod1]=-1; Carlist[sellerid][mod2]=-1; Carlist[sellerid][mod3]=-1; Carlist[sellerid][mod4]=-1; Carlist[sellerid][mod5]=-1; Carlist[sellerid][mod6]=-1; Carlist[sellerid][mod7]=-1; Carlist[sellerid][mod8]=-1; Carlist[sellerid][mod9]=-1; Carlist[sellerid][mod10]=-1; Carlist[sellerid][mod11]=-1; Carlist[sellerid][mod12]=-1; Carlist[sellerid][mod13]=-1; Carlist[sellerid][mod14]=-1; Carlist[sellerid][mod15]=-1; Carlist[sellerid][mod16]=-1; Carlist[sellerid][mod17]=-1; Carlist[sellerid][Paintjob]=-1; if (Carlist[playerid][status]==1) { SetVehicleParamsForAll(Carlist[playerid][Carid],0,Carlist[playerid][Lock]); SetVehicleParamsForPlayer(Carlist[playerid][Carid],playerid,0,0); } format(string,128,"Congratulations! You bought yourself a/an $%s for %i!",Buylist[Carlist[playerid][Typ]][Name],price); SendClientMessage(playerid, COLOR_RED, string); SendClientMessage(playerid, COLOR_GREEN, "If your car is broken, type /fixcar to fix it."); SendClientMessage(playerid, COLOR_GREEN, "You can lock/unlock your car for other players with /lock."); SendClientMessage(playerid, COLOR_GREEN, "Look for more commands with /carhelp."); SendClientMessage(playerid, COLOR_YELLOW, "The car is now yours. Have fun with it!"); new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,128,"You sold %s your car for $%i!",playername, price); SendClientMessage(sellerid, COLOR_RED, string); } else { format(string, 128, "Insufficent money to buy the car (need: $%i)!", offerCar[playerid][1]); SendClientMessage(playerid, COLOR_GREY, string); } } else { offerCar[playerid]={-1,0}; SendClientMessage(playerid, COLOR_GREY, "The seller does not have a car!."); } } else { SendClientMessage(playerid, COLOR_GREY, "You already have a car!"); } } else { offerCar[playerid]={-1,0}; SendClientMessage(playerid, COLOR_GREY, "The seller is offline."); } } else { SendClientMessage(playerid, COLOR_GREY, "There is no car on offer."); } return 1; } #endif return 0; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(playerid); new typ; typ=IsAutohausCar(vehicleid); if(typ!=-1) { new string[128]; TogglePlayerControllable(playerid,0); Spectating[playerid][0]=typ; SetVehicleParamsForAll(vehicleid,0,1); SendClientMessage(playerid, COLOR_YELLOW, "~*~ Car Dealership ~*~"); format(string,128,"Name: %s",Buylist[typ][Name]); SendClientMessage(playerid, COLOR_YELLOW, string); format(string,128,"Price: $%i",Buylist[typ][Price]); SendClientMessage(playerid, COLOR_YELLOW, string); format(string,128,"Cost of repair: $%i",Buylist[typ][Repair]); SendClientMessage(playerid, COLOR_YELLOW, string); SendClientMessage(playerid, COLOR_GREEN, "This car is for sell. To buy it, type: /buycar"); SendClientMessage(playerid, COLOR_GREEN, "If you want to leave the car, type: /exitcar"); } } return 1; } public OnVehicleMod(playerid,vehicleid,componentid) { if (playerid!=GetPlayerFromCarlistCar(vehicleid)) {return 1;} if(playerid!=-1) { new mod=GetModType(componentid); switch (mod) { case 1: { Carlist[playerid][mod1]=componentid; } case 2: { Carlist[playerid][mod2]=componentid; } case 3: { Carlist[playerid][mod3]=componentid; } case 4: { Carlist[playerid][mod4]=componentid; } case 5: { Carlist[playerid][mod5]=componentid; } case 6: { Carlist[playerid][mod6]=componentid; } case 7: { Carlist[playerid][mod7]=componentid; } case 8: { Carlist[playerid][mod8]=componentid; } case 9: { Carlist[playerid][mod9]=componentid; } case 10: { Carlist[playerid][mod10]=componentid; } case 11: { Carlist[playerid][mod11]=componentid; } case 12: { Carlist[playerid][mod12]=componentid; } case 13: { Carlist[playerid][mod13]=componentid; } case 14: { Carlist[playerid][mod14]=componentid; } case 15: { Carlist[playerid][mod15]=componentid; } case 16: { Carlist[playerid][mod16]=componentid; } case 17: { Carlist[playerid][mod17]=componentid; } default: { new string[128]; format(string,128,"Unknown component id: %i",componentid); print(string); } } } return 1; } public OnVehiclePaintjob(playerid,vehicleid, paintjobid) { if (playerid!=GetPlayerFromCarlistCar(vehicleid)) {return 1;} if(playerid!=-1) { Carlist[playerid][Paintjob]=paintjobid; } return 1; } public OnVehicleRespray(playerid,vehicleid, color1, color2) { if (playerid!=GetPlayerFromCarlistCar(vehicleid)) {return 1;} if(playerid!=-1) { Carlist[playerid][Color1]=color1; Carlist[playerid][Color2]=color2; } return 1; } public SetVehicleParamsForAll(carid,objective,doorslocked) { new i; for(i=0; i