for(x=0; x<212; x++){format(string,64,\"/%s\", VehicleNames
for(x = 0; x < 212; x++){ format(string,64,\"/%s\", VehicleNames
Lusta megvan már a kocsi lekérõm csak valamiért nem müködik.
for(x = 0; x < 212; x++){ format(string,64,\"/%s\", VehicleNames);} De fogalmam sincs milyen kód akar ez lenni. a fordító két jel felcserélése miatt reklamált.)}; helyett ); }
CMD:v(playerid,params[]){new carid;if(sscanf(params,\"i\",carid)) return SendClientMessage(playerid,0xCCFFDD56,\"HASZNÁLAT:/v [carID]\");if(carid > 611 || carid < 400) return SendClientMessage(playerid,0xCCFFDD56,\"HIBA: Rosz ID\");SendClientMessage(playerid,0xCCFFDD56,\"Jármû lekérve\");new Float:x,Float:y,Float:z;GetPlayerPos(playerid,x,y,z);new car=CreateVehicle(playerid,x,y,z,95.0,-1,-1,1000);PutPlayerInVehicle(playerid, car, 0);SendClientMessage(playerid,0xCCFFDD56,\"Lespawnoltál egy jármüvet\");return 1;}
for(x = 0; x < 212; x++){ format(string,64,\"/%s\", VehicleNames);} De fogalmam sincs milyen kód akar ez lenni. a fordító két jel felcserélése miatt reklamált.)}; helyett ); } Vehiclename (Infernus,bullet) -> parancs: /infernus, /bullet [/quote]Így se értem mindegy. Neked meg nem kell leírnom hogy ebben a kódban mekkora *****ság van.De azért mégis for ciklus 0 tól 211-ig majd a format függvény segítségével beágyazzuk a string deklarációba a VehicleNames adat tömb adatait egyesével de mindig felülírással, a végeredmény meg az lesz hogy a string tartalma a VehicleNames[211] lesz.DareDevil miért nem írod le pontosan hogy mit is akarsz csinálni?A második hsz-ed után lehetett kivenni hogy te arra készülsz hogy olyan parancsot gyárts amelyik segítségével jármûvet lehet lekérni, jármû modelid (/v 411) vagy jármû név (/v infernus) beírásával.
new VehicleNames[212][] = {{\"landstalker\"},{\"bravura\"},{\"buffalo\"},{\"linerunner\"},{\"perrenial\"},{\"sentinel\"},{\"dumper\"},{\"firetruck\"},{\"trashmaster\"},{\"stretch\"},{\"manana\"},{\"infernus\"},{\"Voodoo\"},{\"pony\"},{\"mule\"},{\"cheetah\"},{\"ambulance\"},{\"leviathan\"},{\"moonbeam\"},{\"esperanto\"},{\"taxi\"},{\"washington\"},{\"bobcat\"},{\"mr whoopee\"},{\"bf injection\"},{\"hunter\"},{\"premier\"},{\"enforcer\"},{\"securicar\"},{\"banshee\"},{\"predator\"},{\"bus\"},{\"rhino\"},{\"barracks\"},{\"hotknife\"},{\"trailer 1\"},{\"previon\"},{\"coach\"},{\"cabbie\"},{\"stallion\"},{\"rumpo\"},{\"rc bandit\"},{\"romero\"},{\"packer\"},{\"monster\"},{\"admiral\"},{\"squalo\"},{\"seasparrow\"},{\"pizzaboy\"},{\"tram\"},{\"trailer 2\"},{\"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\"},{\"quad\"},{\"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\"},{\"boxville\"},{\"benson\"},{\"mesa\"},{\"rc goblin\"},{\"hotring racer a\"},{\"hotring racer b\"},{\"bloodring banger\"},{\"rancher\"},{\"super gt\"},{\"elegant\"},{\"journey\"},{\"bike\"},{\"mountain bike\"},{\"beagle\"},{\"cropdust\"},{\"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 la\"},{\"hustler\"},{\"intruder\"},{\"primo\"},{\"cargobob\"},{\"tampa\"},{\"sunrise\"},{\"merit\"},{\"utility\"},{\"nevada\"},{\"yosemite\"},{\"windsor\"},{\"monster a\"},{\"monster b\"},{\"uranus\"},{\"jester\"},{\"sultan\"},{\"stratum\"},{\"elegy\"},{\"raindance\"},{\"rc tiger\"},{\"flash\"},{\"tahoma\"},{\"savanna\"},{\"bandito\"},{\"freight flat\"},{\"streak carriage\"},{\"kart\"},{\"mower\"},{\"duneride\"},{\"sweeper\"},{\"broadway\"},{\"tornado\"},{\"at-400\"},{\"dft-30\"},{\"huntley\"},{\"stafford\"},{\"bf-400\"},{\"newsvan\"},{\"tug\"},{\"trailer 3\"},{\"emperor\"},{\"wayfarer\"},{\"euros\"},{\"hotdog\"},{\"club\"},{\"freight carriage\"},{\"trailer 3\"},{\"andromada\"},{\"dodo\"},{\"rc cam\"},{\"launch\"},{\"police car (lspd)\"},{\"police car (sfpd)\"},{\"police car (lVpd)\"},{\"police ranger\"},{\"picador\"},{\"s.w.a.t. Van\"},{\"alpha\"},{\"phoenix\"},{\"glendale\"},{\"sadler\"},{\"luggage trailer a\"},{\"luggage trailer b\"},{\"stair trailer\"},{\"boxville\"},{\"farm plow\"},{\"utility trailer\"}};new VehicleNamesSCM[212][] = {//ez azért kell, hogy a chatben nagy betûkkel irja ki.{\"Landstalker\"},{\"Bravura\"},{\"Buffalo\"},{\"Linerunner\"},{\"Perrenial\"},{\"Sentinel\"},{\"Dumper\"},{\"Firetruck\"},{\"Trashmaster\"},{\"Stretch\"},{\"Manana\"},{\"Infernus\"},{\"Voodoo\"},{\"Pony\"},{\"Mule\"},{\"Cheetah\"},{\"Ambulance\"},{\"Leviathan\"},{\"Moonbeam\"},{\"Esperanto\"},{\"Taxi\"},{\"Washington\"},{\"Bobcat\"},{\"Mr Whoopee\"},{\"BF Injection\"},{\"Hunter\"},{\"Premier\"},{\"Enforcer\"},{\"Securicar\"},{\"Banshee\"},{\"Predator\"},{\"Bus\"},{\"Rhino\"},{\"Barracks\"},{\"Hotknife\"},{\"Trailer 1\"},{\"Previon\"},{\"Coach\"},{\"Cabbie\"},{\"Stallion\"},{\"Rumpo\"},{\"RC Bandit\"},{\"Romero\"},{\"Packer\"},{\"Monster\"},{\"Admiral\"},{\"Squalo\"},{\"Seasparrow\"},{\"Pizzaboy\"},{\"Tram\"},{\"Trailer 2\"},{\"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\"},{\"Quad\"},{\"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\"},{\"Boxville\"},{\"Benson\"},{\"Mesa\"},{\"RC Goblin\"},{\"Hotring Racer A\"},{\"Hotring Racer B\"},{\"Bloodring Banger\"},{\"Rancher\"},{\"Super GT\"},{\"Elegant\"},{\"Journey\"},{\"Bike\"},{\"Mountain Bike\"},{\"Beagle\"},{\"Cropdust\"},{\"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 LA\"},{\"Hustler\"},{\"Intruder\"},{\"Primo\"},{\"Cargobob\"},{\"Tampa\"},{\"Sunrise\"},{\"Merit\"},{\"Utility\"},{\"Nevada\"},{\"Yosemite\"},{\"Windsor\"},{\"Monster A\"},{\"Monster B\"},{\"Uranus\"},{\"Jester\"},{\"Sultan\"},{\"Stratum\"},{\"Elegy\"},{\"Raindance\"},{\"RC Tiger\"},{\"Flash\"},{\"Tahoma\"},{\"Savanna\"},{\"Bandito\"},{\"Freight Flat\"},{\"Streak Carriage\"},{\"Kart\"},{\"Mower\"},{\"Duneride\"},{\"Sweeper\"},{\"Broadway\"},{\"Tornado\"},{\"AT-400\"},{\"DFT-30\"},{\"Huntley\"},{\"Stafford\"},{\"BF-400\"},{\"Newsvan\"},{\"Tug\"},{\"Trailer 3\"},{\"Emperor\"},{\"Wayfarer\"},{\"Euros\"},{\"Hotdog\"},{\"Club\"},{\"Freight Carriage\"},{\"Trailer 3\"},{\"Andromada\"},{\"Dodo\"},{\"RC Cam\"},{\"Launch\"},{\"Police Car (LSPD)\"},{\"Police Car (SFPD)\"},{\"Police Car (LVPD)\"},{\"Police Ranger\"},{\"Picador\"},{\"S.W.A.T. Van\"},{\"Alpha\"},{\"Phoenix\"},{\"Glendale\"},{\"Sadler\"},{\"Luggage Trailer A\"},{\"Luggage Trailer B\"},{\"Stair Trailer\"},{\"Boxville\"},{\"Farm Plow\"},{\"Utility Trailer\"}}; a parancs:CMD:v(playerid,params[]){new carid;if(sscanf(params,\"i\",carid)) return SendClientMessage(playerid,0xCCFFDD56,\"HASZNÁLAT:/v [carID]\");if(carid > 611 || carid < 400) return SendClientMessage(playerid,0xCCFFDD56,\"HIBA: Rosz ID\");SendClientMessage(playerid,0xCCFFDD56,\"Jármû lekérve\");new Float:x,Float:y,Float:z;GetPlayerPos(playerid,x,y,z);new car=CreateVehicle(playerid,x,y,z,95.0,-1,-1,1000);PutPlayerInVehicle(playerid, car, 0);return 1;}
new car=CreateVehicle(playerid,x,y,z,95.0,-1,-1,1000);[/quote]Ahova playerid van írva oda vehicleid szükséges amit te carid-del jelölsz a parancsban,és egyáltalán nem szerepel semmilyen rész a parancsban ami arra hivatott hogy keressen jármû névre is.Jha igen és felesleges két ugyanolyan tömb azért mert az egyik nagybetûvel kezdõdik a másik meg nem.
//////////////////////////////////////////////////////////////////////////////// //====== SAMP Jármû Lehvó 0.3/0.2X =======// //======== Készítette: Fedee! ========// //======== Magyarosította/Egyszerûsítette: Mr.M[aa]rK =========// //======== Módosította: ZeRo ========//////////////////////////////////////////////////////////////////////////////////#include <a_samp>#define GELTONA 0xFFFF00FF#define BALTA 0xFFFFFFFF#define COLOR_GREY 0xAFAFAFAA#define COLOR_ORANGE 0xFF9900AA#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, \"\")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1new SpawnedVehicles[MAX_PLAYERS];new VehicleNames[209][] = {{\"Landstalker\"},{\"Bravura\"},{\"Buffalo\"},{\"Linerunner\"},{\"Perrenial\"},{\"Sentinel\"},{\"Dumper\"},{\"Firetruck\"},{\"Trashmaster\"},{\"Stretch\"},{\"Manana\"},{\"Infernus\"},{\"Voodoo\"},{\"Pony\"},{\"Mule\"},{\"Cheetah\"},{\"Ambulance\"},{\"Leviathan\"},{\"Moonbeam\"},{\"Esperanto\"},{\"Taxi\"},{\"Washington\"},{\"Bobcat\"},{\"Mr Whoopee\"},{\"BF Injection\"},{\"Hunter\"},{\"Premier\"},{\"Enforcer\"},{\"Securicar\"},{\"Banshee\"},{\"Predator\"},{\"Bus\"},{\"Barracks\"},{\"Hotknife\"},{\"Trailer 1\"},{\"Previon\"},{\"Coach\"},{\"Cabbie\"},{\"Stallion\"},{\"Rumpo\"},{\"RC Bandit\"},{\"Romero\"},{\"Packer\"},{\"Monster\"},{\"Admiral\"},{\"Squalo\"},{\"Seasparrow\"},{\"Pizzaboy\"},{\"Tram\"},{\"Trailer 2\"},{\"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\"},{\"Quad\"},{\"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\"},{\"Boxville\"},{\"Benson\"},{\"Mesa\"},{\"RC Goblin\"},{\"Hotring Racer A\"},{\"Hotring Racer B\"},{\"Bloodring Banger\"},{\"Rancher\"},{\"Super GT\"},{\"Elegant\"},{\"Journey\"},{\"Bike\"},{\"Mountain Bike\"},{\"Beagle\"},{\"Cropdust\"},{\"Stunt\"},{\"Tanker\"}, {\"Roadtrain\"},{\"Nebula\"},{\"Majestic\"},{\"Buccaneer\"},{\"Shamal\"},{\"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 LA\"},{\"Hustler\"},{\"Intruder\"},{\"Primo\"},{\"Cargobob\"},{\"Tampa\"},{\"Sunrise\"},{\"Merit\"},{\"Utility\"},{\"Nevada\"},{\"Yosemite\"},{\"Windsor\"},{\"Monster A\"},{\"Monster B\"},{\"Uranus\"},{\"Jester\"},{\"Sultan\"},{\"Stratum\"},{\"Elegy\"},{\"Raindance\"},{\"RC Tiger\"},{\"Flash\"},{\"Tahoma\"},{\"Savanna\"},{\"Bandito\"},{\"Freight Flat\"},{\"Streak Carriage\"},{\"Kart\"},{\"Mower\"},{\"Duneride\"},{\"Sweeper\"},{\"Broadway\"},{\"Tornado\"},{\"DFT-30\"},{\"Huntley\"},{\"Stafford\"},{\"BF-400\"},{\"Newsvan\"},{\"Tug\"},{\"Trailer 3\"},{\"Emperor\"},{\"Wayfarer\"},{\"Euros\"},{\"Hotdog\"},{\"Club\"},{\"Freight Carriage\"},{\"Trailer 3\"},{\"Andromada\"},{\"Dodo\"},{\"RC Cam\"},{\"Launch\"},{\"Police Car (LSPD)\"},{\"Police Car (SFPD)\"},{\"Police Car (LVPD)\"},{\"Police Ranger\"},{\"Picador\"},{\"S.W.A.T. Van\"},{\"Alpha\"},{\"Phoenix\"},{\"Glendale\"},{\"Sadler\"},{\"Luggage Trailer A\"},{\"Luggage Trailer B\"},{\"Stair Trailer\"},{\"Boxville\"},{\"Farm Plow\"},{\"Utility Trailer\"}};forward VehicleOccupied(vehicleid);public OnPlayerCommandText(playerid, cmdtext[]){ dcmd(v,1,cmdtext); dcmd(respawncars,11,cmdtext); return 0;}dcmd_v(playerid, params[]){ new Index; new tmp[256]; tmp = strtok(params,Index); new tmp2[256]; tmp2 = strtok(params,Index); new tmp3[256]; tmp3 = strtok(params,Index); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ORANGE, \"Használat: /v [modelid/jármûnév] [szín1] [szín2]\"); new car; new string[128]; new colour1, colour2; if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else if( car == 432 || car == 520 || car == 577 ) return SendClientMessage( playerid, BALTA, \"Hiba: Ezt a jármûvet nem kérheted le!\" ); else car = strval(tmp); if(car < 400 || car > 611) return SendClientMessage(playerid, BALTA, \"Hiba: Nincs ilyen jármû!\"); if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2); if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3); if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]); new Float:X,Float:Y,Float:Z; new Float:Angle,int1; new LVehicleID = GetPlayerVehicleID(playerid); GetPlayerPos(playerid, X,Y,Z); GetPlayerFacingAngle(playerid,Angle); int1 = GetPlayerInterior(playerid); SpawnedVehicles[playerid] = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1); PlayerPlaySound(playerid,1085,0,0,0); PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0); format(string, sizeof(string), \"Jármû lerakva! Név: %s | (Model ID: %d) | Szín1: %d, Szín2: %d\", VehicleNames[car-400], car, colour1, colour2); return SendClientMessage(playerid,COLOR_ORANGE,string);}dcmd_respawncars(playerid,params[]){ #pragma unused params if(!IsPlayerAdmin(playerid)) return 0; //hanem rcon admin akkor Ismeretlen parancs legyen SendClientMessage(playerid, COLOR_GREY, \"Jármûvek Respawnolva!\"); GameTextForAll(\"~n~~n~~n~~n~~n~~n~~r~Jarmuvek ~g~respawnolva Admin altal!\", 3000,3); for(new cars=0; cars<MAX_VEHICLES; cars++) { if(!VehicleOccupied(cars)) { SetVehicleToRespawn(cars); } } return 1;}public OnPlayerDisconnect(playerid){ DestroyVehicle(SpawnedVehicles[playerid]); SpawnedVehicles[playerid] = 0; return 0;}GetVehicleModelIDFromName(vname[]){ for(new i = 0; i < 211; i++) { if ( strfind(VehicleNames, vname, true) != -1 ) return i + 400; } return -1;}stock IsNumeric(string[]){ for (new i = 0, j = strlen(string); i < j; i++) { if (string > \'9\' || string < \'0\') return 0; } return 1;}public VehicleOccupied(vehicleid){ for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerInVehicle(i,vehicleid)) return 1; } return 0;}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;}////////////////////////////////////////////////////////////////////////////////