/sellveh command for players
#1

Hi, i have a personal vehicle system without sell command.

I have just /sellveh command for RCON Admin (this command sells the car to dealership) but i want to make this command for players. Im not a very good scripter and i want someone who can make this command work for players and just in his personal car.

/sellveh:

Код:
if (strcmp("/sellveh", cmdtext, true, 10) == 0)
    {
    	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_ORANGE, "DENIED: {FFFFFF}You are not authorized to use that command.");
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, ORANGE, "You must be in a car for this action");
        if(GetCreatorID(vehicleid)!=0)
        {
       		format(file,64,"personalcars/%s.ini",VehicleSystem[vehicleid][owner]);
       		dini_Remove(file);
            new Float:vx,Float:vy,Float:vz,Float:va;
            GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
            VehicleSystem[GetCreatorID(vehicleid)][xc]=vx;
            VehicleSystem[GetCreatorID(vehicleid)][yc]=vy;
            VehicleSystem[GetCreatorID(vehicleid)][zc]=vz;
            VehicleSystem[GetCreatorID(vehicleid)][ac]=va;
            Locked[GetCreatorID(vehicleid)] = 0;
	        VehicleSystem[GetCreatorID(vehicleid)][Lock] = 0;
            strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar",0,128,128);
            new create = GetCreatorID(vehicleid);
			DestroyVehicle(vehicleid);
   			new CAR = CreateVehicle(VehicleSystem[create][cmodel],VehicleSystem[create][xc],VehicleSystem[create][yc],VehicleSystem[create][zc],VehicleSystem[create][ac],VehicleSystem[create][Farbe1],VehicleSystem[create][Farbe2],-1);
			SetVehicleNumberPlate(CAR, VehicleSystem[GetCreatorID(vehicleid)][owner]);
			VehicleSystem[GetCreatorID(vehicleid)][mod1]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod2]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod3]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod4]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod5]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod6]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod7]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod8]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod9]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod10]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod11]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod12]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod13]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod14]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod15]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod16]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod17]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][paintjob]=255;
	        VehicleSystem[GetCreatorID(vehicleid)][Farbe1]=1;
	        VehicleSystem[GetCreatorID(vehicleid)][Farbe2]=1;
	        ChangeVehicleColor(vehicleid, 1,1);
            SendClientMessage(playerid, COLOR_WHITE, "This car is now for sale! ");
        }
        return 1;
    }
And if you can make /sellvehto for sell the car to a player it be great
Reply
#2

Quote:
Originally Posted by MrBlake
Посмотреть сообщение
Hi, i have a personal vehicle system without sell command.

I have just /sellveh command for RCON Admin (this command sells the car to dealership) but i want to make this command for players. Im not a very good scripter and i want someone who can make this command work for players and just in his personal car.

/sellveh:

Код:
if (strcmp("/sellveh", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, ORANGE, "You must be in a car for this action");
        if(GetCreatorID(vehicleid)!=0)
        {
       		format(file,64,"personalcars/%s.ini",VehicleSystem[vehicleid][owner]);
       		dini_Remove(file);
            new Float:vx,Float:vy,Float:vz,Float:va;
            GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
            VehicleSystem[GetCreatorID(vehicleid)][xc]=vx;
            VehicleSystem[GetCreatorID(vehicleid)][yc]=vy;
            VehicleSystem[GetCreatorID(vehicleid)][zc]=vz;
            VehicleSystem[GetCreatorID(vehicleid)][ac]=va;
            Locked[GetCreatorID(vehicleid)] = 0;
	        VehicleSystem[GetCreatorID(vehicleid)][Lock] = 0;
            strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar",0,128,128);
            new create = GetCreatorID(vehicleid);
			DestroyVehicle(vehicleid);
   			new CAR = CreateVehicle(VehicleSystem[create][cmodel],VehicleSystem[create][xc],VehicleSystem[create][yc],VehicleSystem[create][zc],VehicleSystem[create][ac],VehicleSystem[create][Farbe1],VehicleSystem[create][Farbe2],-1);
			SetVehicleNumberPlate(CAR, VehicleSystem[GetCreatorID(vehicleid)][owner]);
			VehicleSystem[GetCreatorID(vehicleid)][mod1]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod2]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod3]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod4]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod5]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod6]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod7]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod8]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod9]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod10]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod11]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod12]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod13]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod14]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod15]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod16]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod17]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][paintjob]=255;
	        VehicleSystem[GetCreatorID(vehicleid)][Farbe1]=1;
	        VehicleSystem[GetCreatorID(vehicleid)][Farbe2]=1;
	        ChangeVehicleColor(vehicleid, 1,1);
            SendClientMessage(playerid, COLOR_WHITE, "This car is now for sale! ");
        }
        return 1;
    }
And if you can make /sellvehto for sell the car to a player it be great
Here you go.

Код:
if (strcmp("/sellveh", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, ORANGE, "You must be in a car for this action");
        if(GetCreatorID(vehicleid)!=0)
        {
       		format(file,64,"personalcars/%s.ini",VehicleSystem[vehicleid][owner]);
       		dini_Remove(file);
            new Float:vx,Float:vy,Float:vz,Float:va;
            GetVehiclePos(GetPlayerVehicleID(playerid),vx,vy,vz);
            GetVehicleZAngle(GetPlayerVehicleID(playerid),va);
            VehicleSystem[GetCreatorID(vehicleid)][xc]=vx;
            VehicleSystem[GetCreatorID(vehicleid)][yc]=vy;
            VehicleSystem[GetCreatorID(vehicleid)][zc]=vz;
            VehicleSystem[GetCreatorID(vehicleid)][ac]=va;
            Locked[GetCreatorID(vehicleid)] = 0;
	        VehicleSystem[GetCreatorID(vehicleid)][Lock] = 0;
            strmid(VehicleSystem[GetCreatorID(vehicleid)][owner],"dealercar",0,128,128);
            new create = GetCreatorID(vehicleid);
			DestroyVehicle(vehicleid);
   			new CAR = CreateVehicle(VehicleSystem[create][cmodel],VehicleSystem[create][xc],VehicleSystem[create][yc],VehicleSystem[create][zc],VehicleSystem[create][ac],VehicleSystem[create][Farbe1],VehicleSystem[create][Farbe2],-1);
			SetVehicleNumberPlate(CAR, VehicleSystem[GetCreatorID(vehicleid)][owner]);
			VehicleSystem[GetCreatorID(vehicleid)][mod1]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod2]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod3]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod4]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod5]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod6]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod7]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod8]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod9]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod10]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod11]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod12]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod13]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod14]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod15]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod16]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][mod17]=0;
	        VehicleSystem[GetCreatorID(vehicleid)][paintjob]=255;
	        VehicleSystem[GetCreatorID(vehicleid)][Farbe1]=1;
	        VehicleSystem[GetCreatorID(vehicleid)][Farbe2]=1;
	        ChangeVehicleColor(vehicleid, 1,1);
            SendClientMessage(playerid, COLOR_WHITE, "This car is now for sale! ");
        }
        return 1;
    }
Reply
#3

Thanks(rep+) but there are a problem... The command works but you can sell the vehicle of another player. How to make this command work just for your personal car?

Код:
if(dini_Int(PFile(playerid),"HaveCar") == 0) return SendClientMessage(playerid, ORANGE, "[ERROR]You dont have a car");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)