18.04.2013, 16:12
Ey guys, I've got a sellvehicle command, but how can I make it that we can't sell our vehicles to ourselves?
I dont know how to do it? any help?, post me the new code if it's not impossible!
Thank you!
I dont know how to do it? any help?, post me the new code if it's not impossible!
pawn Код:
}
if(strcmp(cmd, "/sellvehicle", true) == 0)
{
new pvehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellvehicle [playerid/PartOfName] [price]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellvehicle [playerid/PartOfName] [price]");
return 1;
}
new price = strvalEx(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(ProxDetectorS(7.0, playerid, giveplayerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
if(PlayerVehicleID1[playerid] == pvehicleid)
{
SellVehicleOffer[giveplayerid] = playerid;
SellVehicleOfferTime[giveplayerid] = 60;
SellVehiclePrice[giveplayerid] = price;
SellVehicleSlot[giveplayerid] = 1;
format(string,sizeof(string),"You have offered to sell your %s to %s for $%d.",vehName[GetVehicleModel(pvehicleid)-400],PlayerName(giveplayerid),price);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"%s has just offered to sell you his %s for $%d, /accept vehicle to buy the vehicle.",PlayerName(playerid),vehName[GetVehicleModel(pvehicleid)-400],price);
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
}
else if(PlayerVehicleID2[playerid] == pvehicleid)
{
SellVehicleOffer[giveplayerid] = playerid;
SellVehicleOfferTime[giveplayerid] = 60;
SellVehiclePrice[giveplayerid] = price;
SellVehicleSlot[giveplayerid] = 2;
format(string,sizeof(string),"You have offered to sell your %s to %s for $%d.",vehName[GetVehicleModel(pvehicleid)-400],PlayerName(giveplayerid),price);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"%s has just offered to sell you his %s for $%d, /accept vehicle to buy the vehicle.",PlayerName(playerid),vehName[GetVehicleModel(pvehicleid)-400],price);
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
}
else if(PlayerVehicleID3[playerid] == pvehicleid)
{
SellVehicleOffer[giveplayerid] = playerid;
SellVehicleOfferTime[giveplayerid] = 60;
SellVehiclePrice[giveplayerid] = price;
SellVehicleSlot[giveplayerid] = 3;
format(string,sizeof(string),"You have offered to sell your %s to %s for $%d.",vehName[GetVehicleModel(pvehicleid)-400],PlayerName(giveplayerid),price);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"%s has just offered to sell you his %s for $%d, /accept vehicle to buy the vehicle.",PlayerName(playerid),vehName[GetVehicleModel(pvehicleid)-400],price);
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
}
else if(PlayerVehicleID4[playerid] == pvehicleid)
{
SellVehicleOffer[giveplayerid] = playerid;
SellVehicleOfferTime[giveplayerid] = 60;
SellVehiclePrice[giveplayerid] = price;
SellVehicleSlot[giveplayerid] = 4;
format(string,sizeof(string),"You have offered to sell your %s to %s for $%d.",vehName[GetVehicleModel(pvehicleid)-400],PlayerName(giveplayerid),price);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"%s has just offered to sell you his %s for $%d, /accept vehicle to buy the vehicle.",PlayerName(playerid),vehName[GetVehicleModel(pvehicleid)-400],price);
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
}
else if(PlayerVehicleID5[playerid] == pvehicleid)
{
SellVehicleOffer[giveplayerid] = playerid;
SellVehicleOfferTime[giveplayerid] = 60;
SellVehiclePrice[giveplayerid] = price;
SellVehicleSlot[giveplayerid] = 5;
format(string,sizeof(string),"You have offered to sell your %s to %s for $%d.",vehName[GetVehicleModel(pvehicleid)-400],PlayerName(giveplayerid),price);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"%s has just offered to sell you his %s for $%d, /accept vehicle to buy the vehicle.",PlayerName(playerid),vehName[GetVehicleModel(pvehicleid)-400],price);
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
}
else
{
SendClientMessage(playerid,COLOR_GREY," You are not at a vehicle that you own.");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY," You are not at any vehicle.");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY," You are not near the player.");
}
}
else
{
SendClientMessage(playerid,COLOR_GREY," Player Not Connected.");
}
}
return 1;
}