Lil help with my car commands
#1

Ok, i've got my command but i'm having an issues with it. It sets the first color of the car just fine but it dosen't set the second color like it's suppose to what is the problem hear i belive i have everything right

pawn Код:
if(!strcmp(tmp, "color",true,4))
      {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /v color [color1] [color2]");
                return 1;
            }
            new color1;
            color1 = strval(tmp);
            if(color1 < 0 || color1 > 252) { SendClientMessage(playerid, COLOR_GREY, "  Color Number can't be below 0 or above 252 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            new color2;
            color2 = strval(tmp);
            if(color2 < 0 || color2 > 252) { SendClientMessage(playerid, COLOR_GREY, "  Color Number can't be below 0 or above 252 !"); return 1; }
            if(!IsPlayerInAnyVehicle(playerid))
            {
              SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in a vehicle !");
              return 1;
            }
            new vehi = GetPlayerVehicleID(playerid);
            if(VehicleInfo[vehi][vOwned] != 1)
            {
              SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
              return 1;
            }
            if(GetPlayerMoney(playerid) < 1000)
            {
              SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have $1000 to change your vehicle color !");
              return 1;
            }
            new plname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, plname, sizeof(plname));
            if(strcmp(plname, VehicleInfo[vehi][vOwner], true) == 0)
            {
                VehicleInfo[vehi][vColorOne] = color1;
                VehicleInfo[vehi][vColorOne] = color2;
                SaveVehicles(playerid, vehi);
                return 1;
            }
    }
Edit:
I'm also having problems with my lock command It locks the car just fine but if you teleport to somewhere then teleport back to your car it's unlocked
pawn Код:
if(!strcmp(tmp, "lock",true,4))
      {
            if(ProxDetectorV(6, playerid, veh1[playerid]))
            {
                VehicleInfo[veh1[playerid]][vLock] = 1;
                SetVehicleParamsForPlayer(veh1[playerid], playerid, 0, 1);
                SaveVehicles(playerid, veh1[playerid]);
                new str[256];
                format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh1[playerid])-400]);
                GameTextForPlayer(playerid, str, 7000, 6);
                return 1;
            }
            if(ProxDetectorV(6, playerid, veh2[playerid]))
            {
                VehicleInfo[veh2[playerid]][vLock] = 1;
                SetVehicleParamsForPlayer(veh2[playerid], playerid, 0, 1);
                SaveVehicles(playerid, veh1[playerid]);
                new str[256];
                format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh2[playerid])-400]);
                GameTextForPlayer(playerid, str, 7000, 6);
                return 1;
            }
            if(ProxDetectorV(6, playerid, veh3[playerid]))
            {
                VehicleInfo[veh3[playerid]][vLock] = 1;
                SetVehicleParamsForPlayer(veh3[playerid], playerid, 0, 1);
                SaveVehicles(playerid, veh3[playerid]);
                new str[256];
                format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh3[playerid])-400]);
                GameTextForPlayer(playerid, str, 7000, 6);
                return 1;
            }
            if(ProxDetectorV(6, playerid, veh4[playerid]))
            {
                VehicleInfo[veh4[playerid]][vLock] = 1;
                SetVehicleParamsForPlayer(veh4[playerid], playerid, 0, 1);
                SaveVehicles(playerid, veh4[playerid]);
                new str[256];
                format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh4[playerid])-400]);
                GameTextForPlayer(playerid, str, 7000, 6);
                return 1;
            }
            if(ProxDetectorV(6, playerid, veh5[playerid]))
            {
                VehicleInfo[veh5[playerid]][vLock] = 1;
                SetVehicleParamsForPlayer(veh5[playerid], playerid, 0, 1);
                SaveVehicles(playerid, veh5[playerid]);
                new str[256];
                format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh5[playerid])-400]);
                GameTextForPlayer(playerid, str, 7000, 6);
                return 1;
            }
        }
Reply
#2

Nothing yet?
Reply
#3

No one has any idea what the problems are? Ahh oh well guess i'll try to figure them out myself
Reply
#4

Yes another bump
Reply
#5

Not sure if this will work, but it's worth a try.

Код:
new tmp2[128];
Код:
if(!strcmp(tmp, "color",true,4))
	{
		if(!strlen(tmp) || !strlen(tmp2))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /v color [color1] [color2]");
			return 1;
		}
		new color1;
		color1 = strval(tmp);
		if(color1 < 0 || color1 > 252) { SendClientMessage(playerid, COLOR_GREY, "  Color Number can't be below 0 or above 252 !"); return 1; }
		tmp = strtok(cmdtext, idx);
		tmp2 = strtok(cmdtext, idx);
		new color2;
		color2 = strval(tmp2);
		if(color2 < 0 || color2 > 252) { SendClientMessage(playerid, COLOR_GREY, "  Color Number can't be below 0 or above 252 !"); return 1; }
		if(!IsPlayerInAnyVehicle(playerid))
		{
			SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in a vehicle !");
			return 1;
		}
		new vehi = GetPlayerVehicleID(playerid);
		if(VehicleInfo[vehi][vOwned] != 1)
		{
			SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
			return 1;
		}
		if(GetPlayerMoney(playerid) < 1000)
		{
			SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have $1000 to change your vehicle color !");
			return 1;
		}
		new plname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, plname, sizeof(plname));
		if(strcmp(plname, VehicleInfo[vehi][vOwner], true) == 0)
		{
			VehicleInfo[vehi][vColorOne] = color1;
			VehicleInfo[vehi][vColorOne] = color2;
			SaveVehicles(playerid, vehi);
			return 1;
		}
	}
Reply
#6

It dosen't work
Reply
#7

Quote:
Originally Posted by [SL~RP
ihatetn931 ]
It dosen't work
About your lock command..

Код:
new VehLocked[MAX_PLAYERS];
Код:
if(!strcmp(tmp, "lock",true,4))
  {
if(ProxDetectorV(6, playerid, veh1[playerid]))
{
VehicleInfo[veh1[playerid]][vLock] = 1;
SetVehicleParamsForPlayer(veh1[playerid], playerid, 0, 1);
VehLocked[playerid] = 1;
SaveVehicles(playerid, veh1[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh1[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 6);
return 1;
}
if(ProxDetectorV(6, playerid, veh2[playerid]))
{
VehicleInfo[veh2[playerid]][vLock] = 1;
SetVehicleParamsForPlayer(veh2[playerid], playerid, 0, 1);
VehLocked[playerid] = 1;
SaveVehicles(playerid, veh1[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh2[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 6);
return 1;
}
if(ProxDetectorV(6, playerid, veh3[playerid]))
{
VehicleInfo[veh3[playerid]][vLock] = 1;
SetVehicleParamsForPlayer(veh3[playerid], playerid, 0, 1);
VehLocked[playerid] = 1;
SaveVehicles(playerid, veh3[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh3[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 6);
return 1;
}
if(ProxDetectorV(6, playerid, veh4[playerid]))
{
VehicleInfo[veh4[playerid]][vLock] = 1;
SetVehicleParamsForPlayer(veh4[playerid], playerid, 0, 1);
VehLocked[playerid] = 1;
SaveVehicles(playerid, veh4[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh4[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 6);
return 1;
}
if(ProxDetectorV(6, playerid, veh5[playerid]))
{
VehicleInfo[veh5[playerid]][vLock] = 1;
SetVehicleParamsForPlayer(veh5[playerid], playerid, 0, 1);
VehLocked[playerid] = 1;
SaveVehicles(playerid, veh5[playerid]);
new str[256];
format(str, sizeof(str), "~w~%s ~r~locked", VehicleNames[GetVehicleModel(veh5[playerid])-400]);
GameTextForPlayer(playerid, str, 7000, 6);
return 1;
}
}
Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	if(VehLocked[forplayerid] == 1)
	{
	  for(new i=0; i<MAX_PLAYERS; i++)
		{
	  	SetVehicleParamsForPlayer(GetPlayerVehicleID(forplayerid),i, 0, 1);
		}
	} else {
	  for(new i=0; i<MAX_PLAYERS; i++)
		{
	  	SetVehicleParamsForPlayer(GetPlayerVehicleID(forplayerid),i, 0, 0);
		}
	}
	return 1;
}
EDIT: Lets give this a try. Maybe this is the issue.

Код:
if(!strcmp(tmp, "color",true,4))
  {
 	 if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /v color [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 252) { SendClientMessage(playerid, COLOR_GREY, "  Color Number can't be below 0 or above 252 !"); return 1; }
tmp = strtok(cmdtext, idx);
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 252) { SendClientMessage(playerid, COLOR_GREY, "  Color Number can't be below 0 or above 252 !"); return 1; }
if(!IsPlayerInAnyVehicle(playerid))
{
  SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in a vehicle !");
  return 1;
}
new vehi = GetPlayerVehicleID(playerid);
if(VehicleInfo[vehi][vOwned] != 1)
{
  SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
  return 1;
}
if(GetPlayerMoney(playerid) < 1000)
{
  SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have $1000 to change your vehicle color !");
  return 1;
}
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[vehi][vOwner], true) == 0)
{
VehicleInfo[vehi][vColorOne] = color1;
VehicleInfo[vehi][vColorTwo] = color2;
SaveVehicles(playerid, vehi);
return 1;
}
  	}
You had:
VehicleInfo[vehi][vColorOne] = color1;
VehicleInfo[vehi][vColorOne] = color2;

I'm guessing it should be:
VehicleInfo[vehi][vColorOne] = color1;
VehicleInfo[vehi][vColorTwo] = color2;
Reply
#8

The lock command still does the same thing, but i must of made a type with the color command and didn't notice it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)