/buycar (Server Unkown command)
#1

Basicly I made a buycar command by myself, anyway seems its not working I tried multiple things but or the command dont do nothing or just send server unkown mensage. Here is the command, Ope you can help.

Код:
if(strcmp(cmd, "/buycar", true) == 0)
	{
	    new model = GetVehicleModel(idcar);
	    if(IsASalesVehicle(idcar))
	    {
			if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999) { }
			else return SendClientMessage(playerid, COLOR_GREY,"* You already own Two cars!");
			if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
			{
				if(PlayerInfo[playerid][pCarLic] == 1)
				{
				    new carid = -1;
				    for(new i = 0; i < sizeof(CarInfo); i++)
					{
					    if(CarInfo[i][cOwned] == 0)
						{
					    	carid = i + 1;
					    	return 1;
						}
					}
					
	     			//File create
					format(string, sizeof(string),"Vehicles/%d.ini",carid);
					dini_Create(string);

					strmid(CarInfo[carid][cOwner], sendername, 0, strlen(sendername), 999);
					
					dini_IntSet(string, "Owned",CarInfo[carid][cOwned] = 1);
					dini_IntSet(string, "Model",CarInfo[carid][cModel] = model);
					dini_IntSet(string, "VirWorld",CarInfo[carid][cVirWorld] = 0);
					dini_IntSet(string, "Model",CarInfo[carid][cModel] = model);
					dini_IntSet(string, "PaintJob",CarInfo[carid][cPaintjob] = 999);
					dini_IntSet(string, "ColorOne",CarInfo[carid][cColorOne] = -1);
					dini_IntSet(string, "ColorTwo",CarInfo[carid][cColorTwo] = -1);
					dini_IntSet(string, "Component0",CarInfo[carid][cComponent0] = 0);
					dini_IntSet(string, "Component1",CarInfo[carid][cComponent1] = 0);
					dini_IntSet(string, "Component2",CarInfo[carid][cComponent2] = 0);
					dini_IntSet(string, "Component3",CarInfo[carid][cComponent3] = 0);
					dini_IntSet(string, "Component4",CarInfo[carid][cComponent4] = 0);
					dini_IntSet(string, "Component5",CarInfo[carid][cComponent5] = 0);
					dini_IntSet(string, "Component6",CarInfo[carid][cComponent6] = 0);
					dini_IntSet(string, "Component7",CarInfo[carid][cComponent7] = 0);
					dini_IntSet(string, "Component8",CarInfo[carid][cComponent8] = 0);
					dini_IntSet(string, "Component9",CarInfo[carid][cComponent9] = 0);
					dini_IntSet(string, "Component10",CarInfo[carid][cComponent10] = 0);
					dini_IntSet(string, "Component11",CarInfo[carid][cComponent11] = 0);
					dini_IntSet(string, "Component12",CarInfo[carid][cComponent12] = 0);
					dini_IntSet(string, "Component13",CarInfo[carid][cComponent13] = 0);
					
					
					ownedcar[carid] = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz],90.0,1,1,30000);

					if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey2] = carid; }
					else { PlayerInfo[playerid][pPcarkey] = carid; }
					SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar));
					if(IsModelAPlane(idcar) || IsModelAHeli(idcar))
					{
						SafeSetPlayerPos(playerid, 2020.6288,-2448.9353,13.5469);
		       			CarInfo[carid][cLocationx] = 2020.6288;
						CarInfo[carid][cLocationy] = -2448.9353;
						CarInfo[carid][cLocationz] = 13.5469;
						CarInfo[carid][cAngle] = 90.0000;
						SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Las Venturas Airport, you can get it there!");
						SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
						SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
					}
					else if(IsModelABoat(idcar))
					{
						new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z);
						SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to San Fierro Docks, you can get it there!");
						SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
						SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
					}
					else
					{
		                SafeSetPlayerPos(playerid,2449.9614,-2620.5871,13.4661);
						CarInfo[carid][cLocationx] = 2461.6628;
						CarInfo[carid][cLocationy] = -2617.1330;
						CarInfo[carid][cLocationz] = 13.4630;
						CarInfo[carid][cAngle] = 90.0000;
						SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to San Fierro Docks, you can get it there!");
						SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
						SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
					}

					PlayerPlayMusic(playerid);
					SendClientMessage(playerid, COLOR_YELLOW2, "Type /vehiclehelp to view the vehicle manual!");
					gEngine[playerid] = 0;
					engineOn[GetPlayerVehicleID(playerid)] = false;
					OnPropUpdate(4,carid);
					OnPlayerUpdateEx(playerid);
				}
				else
				{
					SendClientMessage(playerid, COLOR_CREAM, "For security reasons, a Driving License is needed to buy a car!");
					return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_CREAM, "You don't have enough cash with you ! ");
			    return 1;
			}
		}
	}
Reply
#2

Try now
pawn Код:
if(strcmp(cmd, "/buycar", true) == 0)
    {
        new model = GetVehicleModel(idcar);
        if(IsASalesVehicle(idcar))
        {
            if(PlayerInfo[playerid][pPcarkey] == 9999 || PlayerInfo[playerid][pPcarkey2] == 9999) { }
            else return SendClientMessage(playerid, COLOR_GREY,"* You already own Two cars!");
            if(GetPlayerMoney(playerid) >= GetVehiclePrice(idcar))
            {
                if(PlayerInfo[playerid][pCarLic] == 1)
                {
                    new carid = -1;
                    for(new i = 0; i < sizeof(CarInfo); i++)
                    {
                        if(CarInfo[i][cOwned] == 0)
                        {
                            carid = i + 1;
                            return 1;
                        }
                    }
                   
                    //File create
                    format(string, sizeof(string),"Vehicles/%d.ini",carid);
                    dini_Create(string);

                    strmid(CarInfo[carid][cOwner], sendername, 0, strlen(sendername), 999);
                   
                    dini_IntSet(string, "Owned",CarInfo[carid][cOwned] = 1);
                    dini_IntSet(string, "Model",CarInfo[carid][cModel] = model);
                    dini_IntSet(string, "VirWorld",CarInfo[carid][cVirWorld] = 0);
                    dini_IntSet(string, "Model",CarInfo[carid][cModel] = model);
                    dini_IntSet(string, "PaintJob",CarInfo[carid][cPaintjob] = 999);
                    dini_IntSet(string, "ColorOne",CarInfo[carid][cColorOne] = -1);
                    dini_IntSet(string, "ColorTwo",CarInfo[carid][cColorTwo] = -1);
                    dini_IntSet(string, "Component0",CarInfo[carid][cComponent0] = 0);
                    dini_IntSet(string, "Component1",CarInfo[carid][cComponent1] = 0);
                    dini_IntSet(string, "Component2",CarInfo[carid][cComponent2] = 0);
                    dini_IntSet(string, "Component3",CarInfo[carid][cComponent3] = 0);
                    dini_IntSet(string, "Component4",CarInfo[carid][cComponent4] = 0);
                    dini_IntSet(string, "Component5",CarInfo[carid][cComponent5] = 0);
                    dini_IntSet(string, "Component6",CarInfo[carid][cComponent6] = 0);
                    dini_IntSet(string, "Component7",CarInfo[carid][cComponent7] = 0);
                    dini_IntSet(string, "Component8",CarInfo[carid][cComponent8] = 0);
                    dini_IntSet(string, "Component9",CarInfo[carid][cComponent9] = 0);
                    dini_IntSet(string, "Component10",CarInfo[carid][cComponent10] = 0);
                    dini_IntSet(string, "Component11",CarInfo[carid][cComponent11] = 0);
                    dini_IntSet(string, "Component12",CarInfo[carid][cComponent12] = 0);
                    dini_IntSet(string, "Component13",CarInfo[carid][cComponent13] = 0);
                   
                   
                    ownedcar[carid] = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz],90.0,1,1,30000);

                    if(PlayerInfo[playerid][pPcarkey] != 9999) { PlayerInfo[playerid][pPcarkey2] = carid; }
                    else { PlayerInfo[playerid][pPcarkey] = carid; }
                    SafeGivePlayerMoney(playerid,-GetVehiclePrice(idcar));
                    if(IsModelAPlane(idcar) || IsModelAHeli(idcar))
                    {
                        SafeSetPlayerPos(playerid, 2020.6288,-2448.9353,13.5469);
                        CarInfo[carid][cLocationx] = 2020.6288;
                        CarInfo[carid][cLocationy] = -2448.9353;
                        CarInfo[carid][cLocationz] = 13.5469;
                        CarInfo[carid][cAngle] = 90.0000;
                        SendClientMessage(playerid, COLOR_YELLOW2, "Your Aircraft has been deliveried to Las Venturas Airport, you can get it there!");
                        SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
                        SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
                    }
                    else if(IsModelABoat(idcar))
                    {
                        new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); SafeSetPlayerPos(playerid, X,Y,Z);
                        SendClientMessage(playerid, COLOR_YELLOW2, "Your Boat has been deliveried to San Fierro Docks, you can get it there!");
                        SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
                        SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
                    }
                    else
                    {
                        SafeSetPlayerPos(playerid,2449.9614,-2620.5871,13.4661);
                        CarInfo[carid][cLocationx] = 2461.6628;
                        CarInfo[carid][cLocationy] = -2617.1330;
                        CarInfo[carid][cLocationz] = 13.4630;
                        CarInfo[carid][cAngle] = 90.0000;
                        SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle has been deliveried to San Fierro Docks, you can get it there!");
                        SendClientMessage(playerid, COLOR_YELLOW2, "Your vehicle is unlocked so you can pay someone to deliver it to your new spawn point!");
                        SendClientMessage(playerid, COLOR_NICERED, "REMEMBER: Leaving your car in the deliver point can get your car SOLD by an administration without refund!");
                    }

                    PlayerPlayMusic(playerid);
                    SendClientMessage(playerid, COLOR_YELLOW2, "Type /vehiclehelp to view the vehicle manual!");
                    gEngine[playerid] = 0;
                    engineOn[GetPlayerVehicleID(playerid)] = false;
                    OnPropUpdate(4,carid);
                    OnPlayerUpdateEx(playerid);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_CREAM, "For security reasons, a Driving License is needed to buy a car!");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_CREAM, "You don't have enough cash with you ! ");
                return 1;
            }
        }
    return  1;
    }
Reply
#3

You do not have return 1; in your command.

I don't care if i'm late. I just want to help.
Reply
#4

Roxor, iam appreciated for your help but righ now the command dont do nothing. Dont create any file or any car and dont send the mensagges.
Reply
#5

Quote:
Originally Posted by Romel
Посмотреть сообщение
You do not have return 1; in your command.

I don't care if i'm late. I just want to help.
I think the problem is not that, since after put return 1; command dont do nothing.
Reply
#6

That look same like Raven's code, why you not try something from Raven's?
Reply
#7

Quote:
Originally Posted by McCurdy
Посмотреть сообщение
That look same like Raven's code, why you not try something from Raven's?
Already checked and didnt found the solution.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)