16.09.2009, 09:11
Here is my car purchase command
When I type /purchase and If I don't have 15000$, it says me Car Dealer: Sorry, you don't have enough money to buy a car. When I type this inside of vehicle, it says me Unknown Command. Anyway I bought the car and I can call it with other command. What is the problem?
pawn Код:
if (strcmp(cmdtext, "/purchase", true)==0) // To buy a vehicle. (It will say Unknown Command, but anyway it works) ;)
{
if (GetPlayerMoney(playerid) < 15000)
{
SendClientMessage(playerid,COLOR_YELLOW,"Car Dealer: Sorry, you don't have enough money to buy a car.");
}
else
{
if (IsPlayerInAnyVehicle(playerid) == 1)
{
ownedcar[playerid] = GetPlayerVehicleID(playerid);
dUserSetINT(PlayerName(playerid)).("car",ownedcar[playerid]);
owner[ownedcar[playerid]] = playerid;
SendClientMessage(playerid,COLOR_YELLOW,"Car Dealer: Congragulations! You've bought this vehicle for 15000$");
GivePlayerMoney(playerid,-15000);
}
else
{
SendClientMessage(playerid,COLOR_YELLOW,"Please get in a vehicle to buy it.");
}
}
return 1;
}