SA-MP Forums Archive
Need help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help (/showthread.php?tid=275417)



Need help - 963852741 - 09.08.2011

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 ?


Re: Need help - Dirkon - 09.08.2011

It gives Unknown Command and works or just gives Unknown Command?


Re: Need help - 963852741 - 09.08.2011

and works


Re: Need help - MadeMan - 09.08.2011

Add return 1 at the end

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



Re: Need help - 963852741 - 09.08.2011

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


Re: Need help - MadeMan - 09.08.2011

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


Re: Need help - 963852741 - 09.08.2011

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


Re: Need help - 963852741 - 10.08.2011

some1 ?


Re: Need help - =WoR=Varth - 10.08.2011

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