30.11.2014, 15:34
Where is the error ?
When i try to sell the vehicle to a player it doesn't work!. he accept the request but vehicle doesn't get selled!
When i try to sell the vehicle to a player it doesn't work!. he accept the request but vehicle doesn't get selled!
pawn Код:
else if(dialogid==dialog_VSellTo)
{
new string[128], proposerpid=GetPlayerID(GotProposedToBuyVehicle[playerid][ByPlayer]);
if(GotProposedToBuyVehicle[playerid][VehicleID]!=-1 && IsSellingVehicleToPlayer[proposerpid] && VehicleInfo[GotProposedToBuyVehicle[playerid][VehicleID]][visvalid] && GotProposedToBuyVehicle[playerid][Yes])
{
if(IsPlayerConnected(proposerpid))
{
if(response==1)
{
if(GetPlayerMoney(playerid)>=GotProposedToBuyVehicle[playerid][Cost])
{
GivePlayerMoney(playerid,-GotProposedToBuyVehicle[playerid][Cost]);
GivePlayerMoney(proposerpid,GotProposedToBuyVehicle[playerid][Cost]);
format(VehicleInfo[GotProposedToBuyVehicle[playerid][VehicleID]][vowner],MAX_PLAYER_NAME,"%s",PlayerInfo[playerid][pname]);
RemovePlayerFromVehicle(proposerpid);
LockVehicle(GotProposedToBuyVehicle[playerid][VehicleID]);
format(string,sizeof(string),"%s ha accettato la tua proposta",PlayerInfo[playerid][pname]); //Request Accepted
SendClientMessage(proposerpid,COLOR_INFO,string);
format(string,sizeof(string),"Hai comprato la %s da %s per %d$. Ora и tua",GetVehicleModelName(GetVehicleModel(GotProposedToBuyVehicle[playerid] [VehicleID])),GotProposedToBuyVehicle[playerid][ByPlayer],GotProposedToBuyVehicle[playerid][Cost]); //Vehicles is yours
SendClientMessage(playerid,COLOR_INFO,string);
return 1;
}
else
{
format(string,sizeof(string),"%s non ha abbastanza soldi per poter accettare la tua proposta",PlayerInfo[playerid][pname]); //Not enough money Request aborted
SendClientMessage(proposerpid,COLOR_ALERT,string);
format(string,sizeof(string),"Non hai abbastanza soldi");
SendClientMessage(playerid,COLOR_NO,string);
return 1;
}
}
else
{
format(string,sizeof(string),"%s ha rifiutato la tua proposta",string); //Rquest Refused
SendClientMessage(proposerpid,COLOR_NO,string);
return 1;
}
}
else
{
format(string,sizeof(string),"%s non и connesso, la proposta и annullata",GotProposedToBuyVehicle[playerid][ByPlayer]); //player is not connected request aborted
SendClientMessage(playerid,COLOR_NO,string);
return 1;
}
}
if(GotProposedToBuyVehicle[playerid][VehicleID]!=-1)SaveVehicle(GotProposedToBuyVehicle[playerid][VehicleID]);
GotProposedToBuyVehicle[playerid][VehicleID]=-1;
GotProposedToBuyVehicle[playerid][Cost]=0;
format(GotProposedToBuyVehicle[playerid][ByPlayer],MAX_PLAYER_NAME,"%s","");
IsSellingVehicleToPlayer[proposerpid]=false;
GotProposedToBuyVehicle[playerid][Yes]=false;
return 1;
}