SERVER: Unknown Command, but working
#1

Hello when someone offer me a vehicle and i type /accept vehicle and then it just says SERVER:Unknown Command
but it gives me the car.. But it doesnt say anything else, also it doesnt say to the seller that i accepted the offer
neither does it tell me that i accepted the offer.

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;
                }
                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;
                }
                GetPlayerName(VehicleOffer[playerid], giveplayer, sizeof(giveplayer));
                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 bought the %s for $%d from %s.",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400],VehiclePrice[playerid],giveplayer);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "* %s accepted your vehicle offer, and the $%d was added to your Bank Account.",sendername,VehiclePrice[playerid]);
                SendClientMessage(VehicleOffer[playerid], COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "%s has accepted the business from %s for $%d", sendername,giveplayer,BizPrice[playerid]);
                format(string,sizeof(string),"%s sold their %s to %s, for $%d.",giveplayer,vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400],sendername,Comma(VehiclePrice[playerid]));
                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);
                VehicleOffer[playerid] = 999;
                VehiclePrice[playerid] = 0;
                UpdateAccount(playerid);
                SaveCars();
                return 1;
            }
Reply
#2

https://github.com/Zeex/samp-plugin-...etect/releases
https://github.com/Zeex/samp-plugin-...ith-debug-info

Load crashdetect plugin, re-compile your scripts with debug info, start the server and when you get output with [debug] in server log, post them here.

I'll point out two things for now, just for future reference:
Код:
CarInfo[TrySell[playerid][2]][cOwner]
If TrySell[playerid][2] is not between 0 and the size of CarInfo, run time error 4.

Код:
vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]
If player is not in vehicle, GetVehicleModel returns 0 and subtracting 400 from it, it tries to access element at negative index; hence run time error 4.
Reply
#3

I dont Really get it
Reply
#4

Anyone?
Reply
#5

Try this Mate.
Код:
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!");
			    }
			    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!");
			    }
			    playaid=TrySell[playerid][0];
			    if(TrySell[playaid][0]!=playerid) {
					SendClientMessage(playerid,COLOR_GRAD2,"This player is offline or not trying to sell to you!");
			    }
			    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.");
			    }
				GetPlayerName(VehicleOffer[playerid], giveplayer, sizeof(giveplayer));
				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 bought the %s for $%d from %s.",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400],VehiclePrice[playerid],giveplayer);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "* %s accepted your vehicle offer, and the $%d was added to your Bank Account.",sendername,VehiclePrice[playerid]);
                SendClientMessage(VehicleOffer[playerid], COLOR_LIGHTBLUE, string);
                format(string, sizeof(string), "%s has accepted the business from %s for $%d", sendername,giveplayer,BizPrice[playerid]);
				format(string,sizeof(string),"%s sold their %s to %s, for $%d.",giveplayer,vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400],sendername,Comma(VehiclePrice[playerid]));
				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);
			    VehicleOffer[playerid] = 999;
				VehiclePrice[playerid] = 0;
                UpdateAccount(playerid);
    	        SaveCars();
			    return 1;
			}
Reply
#6

Thanks alot, it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)