What's the problem here -.- -
MattSlater - 28.12.2012
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;
}
Okay, this is when a player enter's the vehicle - I have debugged the fuck out of the vehicle loading system and it loads fine. But for some reason, when I do the command in my vehicle it says I need to be in a vehicle I own, but if I do it in car slot 0(my 1st car) it will work? Any idea, this has really been bugging me, I have tried everything to resolve this ;/
Re: What's the problem here -.- -
MattSlater - 28.12.2012
anyoone please
Re: What's the problem here -.- -
rockerman - 28.12.2012
idk i dont have any idea everything is fine .................................................. ..................
Re: What's the problem here -.- -
Threshold - 28.12.2012
Give this one a shot:
pawn Код:
CMD:sellmyveh(playerid, params[])
{
new id, price, Float: x, Float: y, Float: z, string[128];
new count = 0;
for(new v = 0; v < MAX_PLAYER_VEHICLES; v++)
{
if(IsPlayerInVehicle(playerid, playerVehicles[playerid][v][cID]))
{
count++;
}
else continue;
}
if(count == 0) return SendClientMessage(playerid, COLOR_GREY, "You need to be inside a vehicle that you own to do this!");
if(sscanf(params, "ud", id, price)) return SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /sellmyveh [playerid] [price]");
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Invalid player ID!");
GetPlayerPos(id, x, y, z);
if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)) return SendClientMessage(playerid, COLOR_GREY, "You are not close enough to that player!");
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));
return 1;
}
Re: What's the problem here -.- -
MattSlater - 28.12.2012
That worked thanks!
But when I enter one of my player vehicles, if I do not unstorage the car in slot one then when I enter another one of my player vehicles it will say.. 'You are the owner of this.. *Name of slot 1 vehicle*.' instead of the actual name, IDK why, I have made it print the vehicle ID's on the console and they are different to slot 1.
Code;
pawn Код:
for(new v; v < MAX_PLAYER_VEHICLES; v++) {
if(IsPlayerInVehicle(playerid, playerVehicles[playerid][v][cID])) {
format(string, sizeof(string), "You are the owner of this %s! (/help vehicles)", VehicleName[playerVehicles[playerid][v][cModelID] - 400]);
SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
printf("This is vehicle ID %d.", playerVehicles[playerid][v][cID]);
if(playerVehicles[playerid][v][cTickets] > 0) {
format(string, sizeof(string), "This vehicle has $%d worth of tickets! Head to City Hall to pay them off.", playerVehicles[playerid][v][cTickets]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
}
return 1;
}
}
Re: What's the problem here -.- -
MattSlater - 28.12.2012
Bump ;3:/