28.12.2012, 03:23
pawn Код:
CMD:sellmyveh(playerid, params[])
{
new id, price, Float: x, Float: y, Float: z, string[128];
for(new v = 0; v < MAX_PLAYER_VEHICLES; v++) {
if(IsPlayerInVehicle(playerid, playerVehicles[playerid][v][cID])) {
if(sscanf(params, "ud", id, price)) return SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /sellmyveh [playerid] [price]");
if(IsPlayerConnected(id)) {
GetPlayerPos(id, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)) {
format(string, sizeof(string), "%s has offered you to buy their %s for $%d. (/accept vehicle)", GetPlayerNameEx(playerid), VehicleName[playerVehicles[playerid][GetPlayerVehicleID(playerid)][cModelID] - 400], price);
SendClientMessage(id, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have offered %s to buy your %s for $%d.", GetPlayerNameEx(id), VehicleName[playerVehicles[playerid][GetPlayerVehicleID(playerid)][cModelID] - 400], price);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
SetPVarInt(id, "carSeller", playerid);
SetPVarInt(id, "carPrice", price);
SetPVarInt(id, "carSaleID", GetPlayerVehicleID(playerid));
}
else SendClientMessage(playerid, COLOR_GREY, "You are not close enough to that player!");
}
else SendClientMessage(playerid, COLOR_GREY, "Invalid player ID!");
}
else SendClientMessage(playerid, COLOR_GREY, "You need to be inside a vehicle that you own to do this!");
}
return 1;
}