Not Working
#1

PHP код:
CMD:searchcar(playerid,params[])
{
    new 
idvp,ncar[600],StringSECH[1140],STRCCHAR[1140];
    if(
sscanf(params,"sT[600]",ncar)) return SendClientMessage(playerid,red,"Use: /searchcar [carname]");
    
idvp GetVehicleModelIDFromName(ncar);
    for(new 
i=0;i<MAX_VEHICLES;i++){
    if(
VehicleInfo[playerid][Model] == idvp && VehicleInfo[playerid][Temp] == false) {
       
format(StringSECH,sizeof(StringSECH),"{FFFAFA}Vehicle:{00FF00} %s | {FFFAFA}Owner:{00FF00} %s\n",VehicleName[GetVehicleModel(i)-400],VehicleInfo[i][owner],i);
       
strcat(STRCCHAR,StringSECH);}}
       
ShowPlayerDialog(playerid,601,DIALOG_STYLE_MSGBOX ,"{FFFF00}Search Car",STRCCHAR"Ok""");
    return 
1;

It's compiled but it says "Unknown Command" when i type that command

Please help
Reply
#2

600 is too large for a string mate.
Change ncar[600] to the maximum size of car name, and "sT[600]" to "s[maximum size of car name]"

You're also missing closing brackets;
PHP код:
CMD:searchcar(playerid,params[])
{
    new 
idvp,ncar[30],StringSECH[1140],STRCCHAR[1140];
    if(
sscanf(params,"sT[30]",ncar)) return SendClientMessage(playerid,red,"Use: /searchcar [carname]");
    
idvp GetVehicleModelIDFromName(ncar);
    for(new 
i=0;i<MAX_VEHICLES;i++){
        if(
VehicleInfo[playerid][Model] == idvp && VehicleInfo[playerid][Temp] == false){
              
format(StringSECH,sizeof(StringSECH),"{FFFAFA}Vehicle:{00FF00} %s | {FFFAFA}Owner:{00FF00} %s\n",VehicleName[GetVehicleModel(i)-400],VehicleInfo[i][owner],i);
             
strcat(STRCCHAR,StringSECH);}}
               
ShowPlayerDialog(playerid,601,DIALOG_STYLE_MSGBOX ,"{FFFF00}Search Car",STRCCHAR"Ok""");
        }
    }
    return 
1;

Reply
#3

I got this error :

Код:
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(70) : warning 201: redefinition of constant/macro (symbol "white1")
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(38444) : warning 213: tag mismatch
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(38446) : warning 217: loose indentation
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(38447) : warning 217: loose indentation
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(38448) : warning 209: function "cmd_searchcar" should return a value
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(38449) : error 054: unmatched closing brace ("}")
D:\SA-MP Servers\TestServer\Gamemodes\TestServer.pwn(38450) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

Replace your code with this one.

PHP код:
CMD:searchcar(playerid,params[])
{
    new 
idvp,ncar[128],StringSECH[1140],STRCCHAR[1140];
    if(
sscanf(params,"s[128]",ncar)) return SendClientMessage(playerid,red,"Use: /searchcar [carname]");
    
idvp GetVehicleModelIDFromName(ncar);
    for(new 
i=0;i<MAX_VEHICLES;i++)
    {
        if(
VehicleInfo[playerid][Model] == idvp && VehicleInfo[playerid][Temp] == false)
        {
            
format(StringSECH,sizeof(StringSECH),"{FFFAFA}Vehicle:{00FF00} %s | {FFFAFA}Owner:{00FF00} %s\n",VehicleName[GetVehicleModel(i)-400],VehicleInfo[i][owner],i);
            
strcat(STRCCHAR,StringSECH);
        }
        else
        {
            
ShowPlayerDialog(playerid,601,DIALOG_STYLE_MSGBOX ,"{FFFF00}Search Car",STRCCHAR"Ok""");
        }
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
Replace your code with this one.

PHP код:
CMD:searchcar(playerid,params[])
{
    new 
idvp,ncar[128],StringSECH[1140],STRCCHAR[1140];
    if(
sscanf(params,"s[128]",ncar)) return SendClientMessage(playerid,red,"Use: /searchcar [carname]");
    
idvp GetVehicleModelIDFromName(ncar);
    for(new 
i=0;i<MAX_VEHICLES;i++)
    {
        if(
VehicleInfo[playerid][Model] == idvp && VehicleInfo[playerid][Temp] == false)
        {
            
format(StringSECH,sizeof(StringSECH),"{FFFAFA}Vehicle:{00FF00} %s | {FFFAFA}Owner:{00FF00} %s\n",VehicleName[GetVehicleModel(i)-400],VehicleInfo[i][owner],i);
            
strcat(STRCCHAR,StringSECH);
        }
        else
        {
            
ShowPlayerDialog(playerid,601,DIALOG_STYLE_MSGBOX ,"{FFFF00}Search Car",STRCCHAR"Ok""");
        }
    }
    return 
1;

It says Use: /searchcar [carname] even i type /searchcar infernus
Reply
#6

someone help me please
Reply
#7

Btw, I have this code in SATDM gamemode

PHP код:
new VehicleName[212][0] = {
       
"Landstalker",
       
"Bravura",
       
"Buffalo",
       
"Linerunner",
       
"Pereniel",
       
"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",
       
"Previon",
       
"Coach",
       
"Cabbie",
       
"Stallion",
       
"Rumpo",
       
"RC Bandit",
       
"Romero",
       
"Packer",
       
"Monster Truck",
       
"Admiral",
       
"Squallo",
       
"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",
       
"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",
       
"Hustler",
       
"Intruder",
       
"Primo",
       
"Cargobob",
       
"Tampa",
       
"Sunrise",
       
"Merit",
       
"Utility",
       
"Nevada",
       
"Yosemite",
       
"Windsor",
       
"Monster Truck A",
       
"Monster Truck B",
       
"Uranus",
       
"Jester",
       
"Sultan",
       
"Stratum",
       
"Elegy",
       
"Raindance",
       
"RC Tiger",
       
"Flash",
       
"Tahoma",
       
"Savanna",
       
"Bandito",
       
"Freight",
       
"Trailer",
       
"Kart",
       
"Mower",
       
"Duneride",
       
"Sweeper",
       
"Broadway",
       
"Tornado",
       
"AT-400",
       
"DFT-30",
       
"Huntley",
       
"Stafford",
       
"BF-400",
       
"Newsvan",
       
"Tug",
       
"Trailer",
       
"Emperor",
       
"Wayfarer",
       
"Euros",
       
"Hotdog",
       
"Club",
       
"Trailer",
       
"Trailer",
       
"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",
       
"Luggage Trailer",
       
"Stair Trailer",
       
"Boxville",
       
"Farm Plow",
    
"Utility Trailer"
}; 
I need it for /searchcar ??
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
Check the sscanf topic, there's a `k<vehicle>` specifier.
What should I do with that k<vehicle> ?
Reply
#9

You had an extra i at the end. Replace that line with this.

PHP код:
format(StringSECH,sizeof(StringSECH),"{FFFAFA}Vehicle:{00FF00} %s | {FFFAFA}Owner:{00FF00} %s\n",VehicleName[GetVehicleModel(i)-400],VehicleInfo[i][owner]); 
Also, I don't get what you're trying to do in the if statement in the loop.
Reply
#10

Quote:
Originally Posted by DarkSkull
Посмотреть сообщение
You had an extra i at the end. Replace that line with this.

PHP код:
format(StringSECH,sizeof(StringSECH),"{FFFAFA}Vehicle:{00FF00} %s | {FFFAFA}Owner:{00FF00} %s\n",VehicleName[GetVehicleModel(i)-400],VehicleInfo[i][owner]); 
Also, I don't get what you're trying to do in the if statement in the loop.
what do you mean? i dont get it. can you give me the working command?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)