06.06.2012, 18:07
Hello,
so can someone help me how to /sellcar to be on particular place and if player is not at that place will return him "Error : You are not at car selling lot!:.
and when he does /sellcar it will spawn car at random place at car lot ? please help me
code:
so can someone help me how to /sellcar to be on particular place and if player is not at that place will return him "Error : You are not at car selling lot!:.
and when he does /sellcar it will spawn car at random place at car lot ? please help me

code:
pawn Код:
if(strcmp(cmd, "/sellcar",true)==0)
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) > 16)
new tmpprice = strval(tmp);
if(!strlen(tmp))
{
SendClientUsage(playerid, cmd, "[amount]");
return 1;
}
if(tmpprice < 1)
{
SendClientWarning(playerid, "Invalid price");
return 1;
}
if(tmpprice > 50000000)
{
SendClientWarning(playerid, "Max Amount 50mil");
return 1;
}
new
carfile[ 60 ],
stringa[ 256 ],
r = GetPlayerVehicleID(playerid);
format(carfile, sizeof(carfile),"cars/Car%d.txt", Vehicles[r][cID]);
new asker[MAX_STRING];
format(asker, MAX_STRING, "%s", PlayerName(playerid));
new ownh[MAX_STRING];
ownh = dini_Get(carfile,"owner");
/** here is what i done but its not working **/ if(!IsPlayerInRangeOfPoint(playerid, 10.0, 7321,1448.7345,14.9060,332)) return SendClientError (playerid, " You are not at car selling lot!");
if(!IsPlayerDriver(playerid)) return SendClientError(playerid," You must be the driver of a vehicle." );
if(Vehicles[r][cartype] != 69) return SendClientError(playerid,"Error occured, this vehicle its not ownable!" );
if(Vehicles[r][cOwned] == 1 && strcmp(asker,ownh,false)==0)
{
/** and here is the rangepoint**/ IsPlayerInRangeOfPoint(playerid, 10.0, 7321,1448.7345,14.9060,332);
dini_IntSet(carfile,"carvalue",tmpprice);
Vehicles[r][carvalue] = tmpprice;
dini_IntSet(carfile,"forsale",1);
Vehicles[r][forsale] = 1;
format(stringa,sizeof(stringa),"[Vehicle] You have put this vehicle on sale. Price: $%i",tmpprice);
SendClientInfo(playerid, stringa);
return 1;
}
else SendClientError(playerid,"You dont own this car !");
}