Can't get my car ownership to work
#1

Hello! I'm trying to make car ownership and it sims that i'm stuck in a place.. The command..
Here is what i have get so far:
pawn Код:
dcmd_buycar(playerid, params[])
{
    new car;
    new carid[256];
    format(carid, 256, "%d", GetPlayerVehicleID(playerid));
  new confirm[64];
  sscanf(params, "s", confirm);
    if(strcmp(params, confirm, true) == 0)
    {
      if(car == 0)
      {
        SendClientMessage(playerid, COLOR_YELLOW, "This car is not for sale!");
        }
        else if(car == 1)
        {
          SendClientMessage(playerid, COLOR_YELLOW, "You bought this car for $10000, check /vhelp for commands.");
          dini_Create(carid);
          dini_Set(carid, "name", file);
             car = 0;
        }
    }
    else
    {
        if(GetVehicleModel(playerid) == 404)
        {
          SendClientMessage(playerid, COLOR_YELLOW, "This car costs $10000, type /buycar confirm to buy it.");
          car = 1;
        }
        else
        {
          SendClientMessage(playerid, COLOR_YELLOW, "This car is not for sale!");
        }
    }
    return 1;
}
The problem is that it keep comming up that the car is not for sale! I testing with a car with vehid 404, but it dont work!
Reply
#2

What if the player isn't in a vehicle
Reply
#3

I gonna add that.. That isnt the problem now..
Reply
#4

Код:
		if(GetVehicleModel(playerid) == 404)
		{
		  SendClientMessage(playerid, COLOR_YELLOW, "This car costs $10000, type /buycar confirm to buy it.");
		  car = 1;
		}
		else
		{
		  SendClientMessage(playerid, COLOR_YELLOW, "This car is not for sale!");
		}
Reply
#5

Quote:
Originally Posted by hanzen
Код:
		if(GetVehicleModel(playerid) == 404)
		{
		  SendClientMessage(playerid, COLOR_YELLOW, "This car costs $10000, type /buycar confirm to buy it.");
		  car = 1;
		}
		else
		{
		  SendClientMessage(playerid, COLOR_YELLOW, "This car is not for sale!");
		}
What is wrong there?? That should work..
Reply
#6

Quote:
Originally Posted by Danand
pawn Код:
new caid[256];
format(carid, 256, "%d", GetPlayerVehicleID(playerid));
Lol why?
Just use
pawn Код:
new carid;
carid = GetPlayerVehicleID(playerid);
Reply
#7

Quote:
Originally Posted by JeNkStAX
Quote:
Originally Posted by Danand
pawn Код:
new caid[256];
format(carid, 256, "%d", GetPlayerVehicleID(playerid));
Lol why?
Just use
pawn Код:
new carid;
carid = GetPlayerVehicleID(playerid);
Well, i do get a error when i do not use the way it is now.
Reply
#8

This is a little updated code, i can't get it work.. I don't know what i have to do, tryed everything!!
pawn Код:
dcmd_buycar(playerid, params[])
{
    new car;
    new carid[256];
    format(carid, 256, "%d", GetPlayerVehicleID(playerid));
  new confirm[64];
  sscanf(params, "s", confirm);
  if(IsPlayerInAnyVehicle(playerid))
  {
    if(strcmp(params, "confirm", true) == 0)
    {
      if(car == 0)
      {
        SendClientMessage(playerid, COLOR_YELLOW, "This car is not for sale!");
        }
        else if(car == 1)
        {
          SendClientMessage(playerid, COLOR_YELLOW, "You bought this car for $10000, check /vhelp for commands.");
          dini_Create(carid);
          dini_Set(carid, "name", file);
          car = 0;
        }
    }
    else
    {
        if(GetVehicleModel(playerid) == 404)
        {
          SendClientMessage(playerid, COLOR_YELLOW, "This car costs $10000, type /buycar confirm to buy it.");
          car = 1;
        }
        else
        {
          SendClientMessage(playerid, COLOR_YELLOW, "This car is not for sale!");
        }
    }
    }
    else
    {
      SendClientMessage(playerid, COLOR_YELLOW, "You are'nt in a vehicle!");
    }
    return 1;
}
Reply
#9

Bump
Reply
#10

Never mind, i did it on a other way..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)