09.10.2015, 19:29
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;
}