Need help
#1

pawn Код:
else if(!strcmp(x_v, "sell",true))
            {
                if(!IsPlayerInAnyVehicle(playerid))
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in a vehicle !");
                    return 1;
                }
                if (!(PlayerToPoint(15.0,playerid,1702.8602,-1469.6306,13.5469)|| PlayerToPoint(15.0,playerid,2362.2329,-2519.3853,3.0000)))
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "You are not at a dealership !");
                    return 1;
                }
                new vehi = GetPlayerVehicleID(playerid);
                if(VehicleInfo[vehi][vOwned] != 1)
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
                    return 1;
                }
                new plname[MAX_PLAYER_NAME];
                GetPlayerName(playerid, plname, sizeof(plname));
                if(strcmp(plname, VehicleInfo[vehi][vOwner], true) == 0)
                {
                    new PriceS = (CarsPrices[GetVehicleModel(vehi)-400]*20)/100;
                    new Price = CarsPrices[GetVehicleModel(vehi)-400]-PriceS;
                    format(string, sizeof(string), "Vehicles/Vehicles/%s.%s.cfg", plname, VehicleNames[GetVehicleModel(vehi)-400]);
                    new str[256];
                    format(str, sizeof(str), "%s.%s", plname, VehicleNames[GetVehicleModel(vehi)-400]);
                    if(strfind(str, PlayerVehicle[playerid][pVeh1], true) == 0)
                    {
                        SetVehicleToRespawn(vehi);
                        DestroyVehicle(vehi);
                        veh1[playerid] = 999;
                        dini_Remove(string);
                        strmid(PlayerVehicle[playerid][pVeh1], "None", 0, strlen("None"), 255);
                        GiveCash(playerid, Price);
                        format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        return 1;
                    }
                    else if(strcmp(str, PlayerVehicle[playerid][pVeh2], true) == 0)
                    {
                        SetVehicleToRespawn(vehi);
                        DestroyVehicle(vehi);
                        veh2[playerid] = 999;
                        dini_Remove(string);
                        strmid(PlayerVehicle[playerid][pVeh2], "None", 0, strlen("None"), 255);
                        GiveCash(playerid, Price);
                        format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        return 1;
                    }
                    else if(strcmp(str, PlayerVehicle[playerid][pVeh3], true) == 0)
                    {
                        SetVehicleToRespawn(vehi);
                        DestroyVehicle(vehi);
                        veh3[playerid] = 999;
                        dini_Remove(string);
                        strmid(PlayerVehicle[playerid][pVeh3], "None", 0, strlen("None"), 255);
                        GiveCash(playerid, Price);
                        format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        return 1;
                    }
                    else if(strcmp(str, PlayerVehicle[playerid][pVeh4], true) == 0)
                    {
                        SetVehicleToRespawn(vehi);
                        DestroyVehicle(vehi);
                        veh4[playerid] = 999;
                        dini_Remove(string);
                        strmid(PlayerVehicle[playerid][pVeh4], "None", 0, strlen("None"), 255);
                        GiveCash(playerid, Price);
                        format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        return 1;
                    }
                    else if(strcmp(str, PlayerVehicle[playerid][pVeh5], true) == 0)
                    {
                        SetVehicleToRespawn(vehi);
                        DestroyVehicle(vehi);
                        veh5[playerid] = 999;
                        dini_Remove(string);
                        strmid(PlayerVehicle[playerid][pVeh5], "None", 0, strlen("None"), 255);
                        GiveCash(playerid, Price);
                        format(string, sizeof(string), "You sold your %s and you gain $%d", VehicleNames[GetVehicleModel(vehi)-400], Price);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        return 1;
                    }
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
                    return 1;
                }
            }
returns "Unknown Command". Why ?
Reply
#2

It gives Unknown Command and works or just gives Unknown Command?
Reply
#3

and works
Reply
#4

Add return 1 at the end

pawn Код:
else
                {
                    SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
                    return 1;
                }
                return 1;
            }
Reply
#5

C:\Documents and Settings\user\щемзп дтбегд\SA-MP\ъйчйд згщд\gamemodes\Revision-001.pwn(41553) : warning 225: unreachable code
the return 1; gives me the error
Reply
#6

Remove this one and add return 1 at the end of the command.
Reply
#7

still doesn't work.
no warning, but gives me Unknown Command.
Reply
#8

some1 ?
Reply
#9

Miss read.
Show us the full command.
For quick fix, just return 1 before closing brakcet "}" of the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)