SA-MP Forums Archive
Can't get my car ownership to work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Can't get my car ownership to work (/showthread.php?tid=72533)



Can't get my car ownership to work - Danand - 09.04.2009

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!


Re: Can't get my car ownership to work - gijsmin - 09.04.2009

What if the player isn't in a vehicle


Re: Can't get my car ownership to work - Danand - 09.04.2009

I gonna add that.. That isnt the problem now..


Re: Can't get my car ownership to work - hanzen - 09.04.2009

Код:
		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!");
		}



Re: Can't get my car ownership to work - Danand - 09.04.2009

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..


Re: Can't get my car ownership to work - ICECOLDKILLAK8 - 09.04.2009

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);



Re: Can't get my car ownership to work - Danand - 10.04.2009

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.


Re: Can't get my car ownership to work - Danand - 10.04.2009

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;
}



Re: Can't get my car ownership to work - Danand - 10.04.2009

Bump


Re: Can't get my car ownership to work - Danand - 10.04.2009

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