/vehicle park command problem
#1

Why It Says: SERVER: Unknown command.

EDIT: In These Codes:
pawn Код:
else if(strcmp(x_nr,"park",true) == 0)
            {
                new Float:x,Float:y,Float:z;
                new Float:a;
                new carid;
                new getcarid;
                new pname[MAX_PLAYER_NAME];
                GetPlayerName(playerid,pname,sizeof(pname));
                getcarid = GetPlayerVehicleID(playerid);
                carid = GetPlayerVehicleID(playerid);
                GetPlayerName(playerid, playername, sizeof(playername));
                GetVehiclePos(carid, x, y, z);
                GetVehicleZAngle(carid, a);
                if(!strcmp(CarInfo[getcarid][cOwner], pname, false) && IsPlayerInVehicle(playerid,carid) && CarInfo[carid][cOwned] == 1)
                {
                    if(PlayerInfo[playerid][pPcarkey] == 9999  && PlayerInfo[playerid][pPcarkey2] == 9999)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You don't own a vehicle.");
                        return 1;
                    }
                    if(getcarid == carid)
                    {
                        CarInfo[carid][cLocationx] = x;
                        CarInfo[carid][cLocationy] = y;
                        CarInfo[carid][cLocationz] = z;
                        CarInfo[carid][cAngle] = a;
                        new area[35];
                        GetPlayer2DZone(playerid, area, sizeof(area));
                        format(string, sizeof(string), "~w~Parked ~n~~b~(%s).",area);
                        GameTextForPlayer(playerid, string, 10000, 3);
                        format(string, sizeof(string), "Vehicle Parked: %f.01, %f.01, %f.01   Location: %s",x,y,z,area);
                        SendClientMessage(playerid, COLOR_YELLOW2, string);
                        OnPropUpdate(1,carid);
                        OnPlayerUpdateEx(playerid);
                        DestroyVehicle(carid);
                        ownedcar[carid] = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
                        if(CarInfo[carid][cPaintjob] != 999)
                        {
                            ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
                        }
                        SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
                        SetVehicleModifications(carid);
                        TogglePlayerControllable(playerid, 1);
                        PutPlayerInVehicle(playerid, carid, 0);
                        return 1;
                    }
                }
            }
Reply
#2

You're not showing enough code. I can assume this is returning 0: strcmp(x_nr,"park",true)

Therefore, none of the code you're showing is being executed.

And strcmp + an if/elseif/elseif/elseif/elseif structure is so wrong. strcmp("a", "b") will return 1, so from then on you'll already know that the first letter is b - you can re-use that information to narrow down the rest of the comparisons and save your code a lot of work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)