Bug in /accept vehicle command
#1

Hello, i have a vehicle system where you can sell your vehicles to other players, /v sell, but when you type /accept vehicle, it just says SERVER: Unknown Command, but it still takes the Money. and i can see the vehicle in /v list. but the seller can keep selling the vehicle to everyone else, and i cant /v park it or anything, it says the vehicle doesnt belong to me... i hope you Guys can help me

pawn Код:
else if(strcmp(x_job,"vehicle",true) == 0)
            {
                new buyername[MAX_PLAYER_NAME];
                if(TrySell[playerid][0]==SCRIPT_PLAYERS) {
                    SendClientMessage(playerid,COLOR_GRAD2,"No one has offered to sell you their car!");
                    return 1;
                }
                new cost=TrySell[playerid][1];
                GetPlayerName(playerid,playername,sizeof(playername));
                if(GetMoney(playerid)<cost) {
                    SendClientMessage(playerid,COLOR_GRAD2,"You don't even have enough cash!");
                    return 1;
                }
                playaid=TrySell[playerid][0];
                if(TrySell[playaid][0]!=playerid) {
                    SendClientMessage(playerid,COLOR_GRAD2,"This player is offline or not trying to sell to you!");
                    return 1;
                }
                GetPlayerName(playaid,buyername,sizeof(buyername)); //actually the reverse.
                if(PlayerInfo[playerid][pCarkey]==SCRIPT_CARS) {
                    PlayerInfo[playerid][pCarkey]=TrySell[playerid][2];
                } else if(PlayerInfo[playerid][pCarkey2]==SCRIPT_CARS) {
                    PlayerInfo[playerid][pCarkey2]=TrySell[playerid][2];
                } else if(PlayerInfo[playerid][pCarkey3]==SCRIPT_CARS) {
                    PlayerInfo[playerid][pCarkey3]=TrySell[playerid][2];
                } else if(PlayerInfo[playerid][pCarkey4]==SCRIPT_CARS) {
                    PlayerInfo[playerid][pCarkey4]=TrySell[playerid][2];
                } else if(PlayerInfo[playerid][pCarkey5]==SCRIPT_CARS) {
                    PlayerInfo[playerid][pCarkey5]=TrySell[playerid][2];
                } else {
                    SendClientMessage(playerid,COLOR_GRAD2,"You already have 5 vehicles.");
                    return 1;
                }

                strcpy(CarInfo[TrySell[playerid][2]][cOwner],playername,MAX_PLAYER_NAME);
                KillPlayerCarKey(playaid,TrySell[playerid][2]);
                GiveMoney(playaid,cost);
                GiveMoney(playerid,-cost);
                TrySell[playerid][0]=SCRIPT_PLAYERS;
                TrySell[playaid][0]=SCRIPT_PLAYERS;
                format(string, sizeof(string), "You have successfully sold your %s to %s.",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400],MaskOnOff(playerid));
                SendClientMessage(playaid, COLOR_GRAD2, string);
                format(string, sizeof(string), "You have successfully purchesed this %s, from %s.",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400],MaskOnOff(playaid));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                format(string,sizeof(string),"%s has purchased %s's %s.",Name(playerid),playaid,vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
                ProxDetector(30.0,playerid,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                format(tmp,sizeof(tmp),"%s sells his car to %s for $%i, Car ID %i",buyername,playername,cost,TrySell[playerid][2]); //buyername isn't the buyers name, its the sellers
                PayLog(tmp);
                return 1;
            }
Reply
#2

REP+ for the one that can help me
Reply
#3

I dont really get it


PHP код:
       if(strcmp(params,"car",true) == 0) {
            if(
VehicleOffer[playerid] < 999) {
                if(
IsPlayerConnected(VehicleOffer[playerid])) {
                    if(
GetPlayerCash(playerid) > VehiclePrice[playerid]) {
                        if(
IsPlayerInVehicle(VehicleOffer[playerid], PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId])) {
                            if(!
ProxDetectorS(8.0VehicleOffer[playerid], playerid)) return SendClientMessage(playeridCOLOR_GREY"You're not near the car dealer");
                            new 
playervehicleid GetPlayerFreeVehicleId(playerid);
                            new 
carsamount GetPlayerVehicleCount(playerid);
                                
SendClientMessage(playeridCOLOR_GREY"ERROR: You can't have more cars, non-donator can only own 5 cars.");
                                return 
1;
                            }
                            new 
ip[32], ipex[32];
                            
GetPlayerIp(playeridipsizeof(ip));
                            
GetPlayerIp(VehicleOffer[playerid], ipexsizeof(ipex));
                            
format(stringsizeof(string), "[CAR] %s (IP: %s) has paid $%d to %s for the %s (IP: %s)"GetPlayerNameEx(playerid), ipVehiclePrice[playerid], GetPlayerNameEx(VehicleOffer[playerid]), GetVehicleName(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId]), ipex);
                            
Log("logs/pay.log"string);
                            
GetPlayerName(VehicleOffer[playerid], giveplayersizeof(giveplayer));
                            
GetPlayerName(playeridsendernamesizeof(sendername));
                            
format(stringsizeof(string), "* You bought the %s for $%d, from %s. (Check /carhelp for more help)"GetVehicleName(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId]), VehiclePrice[playerid],giveplayer);
                            
SendClientMessage(playeridCOLOR_LIGHTBLUEstring);
                            
format(stringsizeof(string), "* You sold your %s to %s for $%d.",GetVehicleName(PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId]), sendername,VehiclePrice[playerid]);
                            
SendClientMessage(VehicleOffer[playerid], COLOR_LIGHTBLUEstring);
                            
GivePlayerCash(VehicleOffer[playerid], VehiclePrice[playerid]);
                            
GivePlayerCash(playerid, -VehiclePrice[playerid]);
                            
RemovePlayerFromVehicle(VehicleOffer[playerid]);
                            new 
Float:slxFloat:slyFloat:slz;
                            
GetPlayerPos(VehicleOffer[playerid], slxslyslz);
                            
SetPlayerPos(VehicleOffer[playerid], slxslyslz+2);
                            
PlayerVehicleInfo[playerid][playervehicleid][pvId] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvNeon] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvNeon];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvModelId] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvModelId];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvPosX] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosX];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvPosY] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosY];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvPosZ] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosZ];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosAngle];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvLock] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvLock];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvLocked] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvLocked];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvPaintJob] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPaintJob];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvColor1] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvColor1];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvColor2] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvColor2];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvAllowedPlayerId] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvAllowedPlayerId];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvPark] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPark];
                            
PlayerVehicleInfo[playerid][playervehicleid][pvSpawned] = 1;
                            
VehicleSpawned[playerid]++;
                            for(new 
0MAX_MODSm++) {
                                
PlayerVehicleInfo[playerid][playervehicleid][pvMods][m] = PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvMods][m];
                            }
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvId] = 0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvModelId] = 0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosX] = 0.0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosY] = 0.0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosZ] = 0.0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPosAngle] = 0.0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvLock] = 0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvLocked] = 0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPaintJob] = -1;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvColor1] = 0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvImpounded] = 0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvColor2] = 0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvAllowedPlayerId] = INVALID_PLAYER_ID;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvPark] = 0;
                            
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvSpawned] = 0;
                            
VehicleSpawned[VehicleOffer[playerid]]--;
                            for(new 
0MAX_MODSm++) {
                                
PlayerVehicleInfo[VehicleOffer[playerid]][VehicleId[playerid]][pvMods][m] = 0;
                            }
                            
VehicleOffer[playerid] = 999;
                            
VehiclePrice[playerid] = 0;
                            return 
1;
                        }
                        else {
                            
SendClientMessage(playeridCOLOR_GREY"   The Car Dealer is not in the offered car!");
                            return 
1;
                        }
                    }
                    else {
                        
SendClientMessage(playeridCOLOR_GREY"   You can't afford the car!");
                        return 
1;
                    }
                }
                return 
1;
            }
            else {
                
SendClientMessage(playeridCOLOR_GREY"   Nobody offered to buy a car!");
                return 
1;
            } 
This is my own version of this command hope it works.
Reply
#4

It doesnt Work, thank you anyways
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)