Some parts of /v get (1-5) work, and some parts don't.
#1

I've had this problem for the longest time.. my friend (ID: 1) can do /v get 2, 3, 4, and 5, but /v get 1 doesn't work for him. And for me, (ID: 0) I can do /v get 1, 3, 4, 5, but /v get 2 doesn't work. My /v get commands looks perfectly fine, but it doesn't work. I assume the problem might be in LoadVehicles, but I'm not sure.

Command:
Код:
else if (strcmp(cmd, "get", true))
		{
			tmp = strtok(cmdtext, idx);
			switch(strval(tmp))
			{
				case 1:
				{
					if(IsVehicleSpawned(veh1[playerid]))
					{
						SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle!");
						new vZone[MAX_ZONE_NAME];
						GetVehicleZone(veh1[playerid], vZone, MAX_ZONE_NAME);
						format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh1[playerid])-400], vZone);
						SendClientMessage(playerid, COLOR_YELLOW, string);
					}
					else if(strcmp(PlayerVehicle[playerid][pVeh1], "None", true))
					{
							LoadVehicles(playerid, PlayerVehicle[playerid][pVeh1]);
							Engine[veh1[playerid]] = 0;
					}
					else
					{
						SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own any vehicles!");
					}
				}
				case 2:
				{
					if(strcmp(PlayerVehicle[playerid][pVeh2], "None", true))
					{
							LoadVehicles(playerid, PlayerVehicle[playerid][pVeh2]);
							Engine[veh2[playerid]] = 0;
					}
					else if(IsVehicleSpawned(veh2[playerid]))
					{
							SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle!");
							new vZone[MAX_ZONE_NAME];
							GetVehicleZone(veh2[playerid], vZone, MAX_ZONE_NAME);
							format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh2[playerid])-400], vZone);
							SendClientMessage(playerid, COLOR_YELLOW, string);
					}
					else
					{
					SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own 2 vehicles!");
					}
				}
				case 3:
				{
					if(IsVehicleSpawned(veh3[playerid]))
					{
							SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle!");
							new vZone[MAX_ZONE_NAME];
							GetVehicleZone(veh3[playerid], vZone, MAX_ZONE_NAME);
							format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh3[playerid])-400], vZone);
							SendClientMessage(playerid, COLOR_YELLOW, string);
							}
					else if(strcmp(PlayerVehicle[playerid][pVeh3], "None", true))
					{
							LoadVehicles(playerid, PlayerVehicle[playerid][pVeh3]);
							Engine[veh3[playerid]] = 0;
					}
					else
					{
					SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own 3 vehicles!");
					}
				}
				case 4:
				{
					if(IsVehicleSpawned(veh4[playerid]))
					{
							SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle!");
							new vZone[MAX_ZONE_NAME];
							GetVehicleZone(veh4[playerid], vZone, MAX_ZONE_NAME);
							format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh4[playerid])-400], vZone);
							SendClientMessage(playerid, COLOR_YELLOW, string);
							}
					else if(strcmp(PlayerVehicle[playerid][pVeh4], "None", true))
					{
							LoadVehicles(playerid, PlayerVehicle[playerid][pVeh4]);
							Engine[veh4[playerid]] = 0;
					}
					else
					{
					SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own 4 vehicles!");
					}
				}
				case 5:
				{
					if(IsVehicleSpawned(veh5[playerid]))
					{
							SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle!");
							new vZone[MAX_ZONE_NAME];
							GetVehicleZone(veh5[playerid], vZone, MAX_ZONE_NAME);
							format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh5[playerid])-400], vZone);
							SendClientMessage(playerid, COLOR_YELLOW, string);
							}
					else if(strcmp(PlayerVehicle[playerid][pVeh5], "None", true))
					{
							LoadVehicles(playerid, PlayerVehicle[playerid][pVeh5]);
							Engine[veh5[playerid]] = 0;
					}
					else
					{
					SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own 5 vehicles!");
					}
				}
			}
			return 1;
    }
And LoadVehicles:
Код:
public LoadVehicles(playerid, string[])
{
	new file[256];
	new plname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, plname, sizeof(plname));
	format(file, sizeof(file), "SouthWestRP/Dealership/%s.cfg", string);
	if(strcmp(string, PlayerVehicle[playerid][pVeh1], true) == 0)
 {
		veh1[playerid] = CreateVehicle(dini_Int(file, "Model"), dini_Float(file, "ParkX"), dini_Float(file, "ParkY"), dini_Float(file, "ParkZ"), dini_Float(file, "ParkAngle"), dini_Int(file, "Color1"), dini_Int(file, "Color2"), 60000);
		strmid(VehicleInfo[veh1[playerid]][vOwner], dini_Get(file, "Owner"), 0, strlen(dini_Get(file, "Owner")), 255);
 		strmid(VehicleInfo[veh1[playerid]][vDescription], dini_Get(file, "Description"), 0, strlen(dini_Get(file, "Description")), 255);
		VehicleInfo[veh1[playerid]][vModel] = dini_Int(file, "Model");
		VehicleInfo[veh1[playerid]][vX] = dini_Float(file, "ParkX");
		VehicleInfo[veh1[playerid]][vY] = dini_Float(file, "ParkY");
		VehicleInfo[veh1[playerid]][vZ] = dini_Float(file, "ParkZ");
		VehicleInfo[veh1[playerid]][vAngle] = dini_Float(file, "ParkAngle");
		VehicleInfo[veh1[playerid]][vColorOne] = dini_Int(file, "color1");
		VehicleInfo[veh1[playerid]][vColorTwo] = dini_Int(file, "color2");
		VehicleInfo[veh1[playerid]][vOwned] = dini_Int(file, "Owned");
 		VehicleInfo[veh1[playerid]][vLock] = dini_Int(file, "Lock");
 		VehicleInfo[veh1[playerid]][vLockBuyed] = dini_Int(file, "LockBuyed");
 		VehicleInfo[veh1[playerid]][vRentPrice] = dini_Int(file, "RentPrice");
		VehicleInfo[veh1[playerid]][vAlarm] = dini_Int(file, "Alarm");
 		IsOwned[veh1[playerid]] = 1;
		new sb[256]; format(sb, sizeof(sb), "Your %s has spawned in the place where you have parked it.", VehicleNames[GetVehicleModel(veh1[playerid])-400]); SendClientMessage(playerid, COLOR_YELLOW, sb);
		format(sb, sizeof(sb), "INFO: Model:[%s] |Owner:[%s] |Description:[%s] |LockLevel:[%d] |RentPrice: [$%d] |AlarmLevel:[%d]", VehicleNames[GetVehicleModel(veh1[playerid])-400], VehicleInfo[veh1[playerid]][vOwner], string,
		VehicleInfo[veh1[playerid]][vLock], VehicleInfo[veh1[playerid]][vRentPrice], VehicleInfo[veh1[playerid]][vAlarm]);
		SendClientMessage(playerid, COLOR_GREEN, sb);
		if(VehicleInfo[veh1[playerid]][vLock] > 0)
		{
			SetVehicleParamsForPlayer(veh1[playerid], 0, 0, 1);
			return 1;
		}
		return 1;
	}
	else if(strcmp(string, PlayerVehicle[playerid][pVeh2], true) == 0)
	{
		veh2[playerid] = CreateVehicle(dini_Int(file, "Model"), dini_Float(file, "ParkX"), dini_Float(file, "ParkY"), dini_Float(file, "ParkZ"), dini_Float(file, "ParkAngle"), dini_Int(file, "Color1"), dini_Int(file, "Color2"), 60000);
		strmid(VehicleInfo[veh2[playerid]][vOwner], dini_Get(file, "Owner"), 0, strlen(dini_Get(file, "Owner")), 255);
 		strmid(VehicleInfo[veh2[playerid]][vDescription], dini_Get(file, "Description"), 0, strlen(dini_Get(file, "Description")), 255);
		VehicleInfo[veh2[playerid]][vModel] = dini_Int(file, "Model");
		VehicleInfo[veh2[playerid]][vX] = dini_Float(file, "ParkX");
		VehicleInfo[veh2[playerid]][vY] = dini_Float(file, "ParkY");
		VehicleInfo[veh2[playerid]][vZ] = dini_Float(file, "ParkZ");
		VehicleInfo[veh2[playerid]][vAngle] = dini_Float(file, "ParkAngle");
		VehicleInfo[veh2[playerid]][vColorOne] = dini_Int(file, "color1");
		VehicleInfo[veh2[playerid]][vColorTwo] = dini_Int(file, "color2");
	 	VehicleInfo[veh2[playerid]][vOwned] = dini_Int(file, "Owned");
 		VehicleInfo[veh2[playerid]][vLock] = dini_Int(file, "Lock");
 		VehicleInfo[veh2[playerid]][vLockBuyed] = dini_Int(file, "LockBuyed");
 		VehicleInfo[veh2[playerid]][vRentPrice] = dini_Int(file, "RentPrice");
		VehicleInfo[veh2[playerid]][vAlarm] = dini_Int(file, "Alarm");
 		IsOwned[veh2[playerid]] = 1;
		new sb[256]; format(sb, sizeof(sb), "Your %s has spawned in the place where you have parked it.", VehicleNames[GetVehicleModel(veh2[playerid])-400]); SendClientMessage(playerid, COLOR_YELLOW, sb);
		format(sb, sizeof(sb), "INFO: Model:[%s] |Owner:[%s] |Description:[%s] |LockLevel:[%d] |RentPrice: [$%d] |AlarmLevel:[%d]", VehicleNames[GetVehicleModel(veh2[playerid])-400], VehicleInfo[veh2[playerid]][vOwner], string,
		VehicleInfo[veh2[playerid]][vLock], VehicleInfo[veh2[playerid]][vRentPrice], VehicleInfo[veh2[playerid]][vAlarm]);
		SendClientMessage(playerid, COLOR_GREEN, sb);
		if(VehicleInfo[veh2[playerid]][vLock] > 0)
		{
			SetVehicleParamsForPlayer(veh2[playerid], 0, 0, 1);
			return 1;
		}
		return 1;
	}
	else if(strcmp(string, PlayerVehicle[playerid][pVeh3], true) == 0)
	{
		veh3[playerid] = CreateVehicle(dini_Int(file, "Model"), dini_Float(file, "ParkX"), dini_Float(file, "ParkY"), dini_Float(file, "ParkZ"), dini_Float(file, "ParkAngle"), dini_Int(file, "Color1"), dini_Int(file, "Color2"), 60000);
		strmid(VehicleInfo[veh3[playerid]][vOwner], dini_Get(file, "Owner"), 0, strlen(dini_Get(file, "Owner")), 255);
 		strmid(VehicleInfo[veh3[playerid]][vDescription], dini_Get(file, "Description"), 0, strlen(dini_Get(file, "Description")), 255);
		VehicleInfo[veh3[playerid]][vModel] = dini_Int(file, "Model");
		VehicleInfo[veh3[playerid]][vX] = dini_Float(file, "ParkX");
		VehicleInfo[veh3[playerid]][vY] = dini_Float(file, "ParkY");
		VehicleInfo[veh3[playerid]][vZ] = dini_Float(file, "ParkZ");
		VehicleInfo[veh3[playerid]][vAngle] = dini_Float(file, "ParkAngle");
		VehicleInfo[veh3[playerid]][vColorOne] = dini_Int(file, "color1");
		VehicleInfo[veh3[playerid]][vColorTwo] = dini_Int(file, "color2");
	 	VehicleInfo[veh3[playerid]][vOwned] = dini_Int(file, "Owned");
 		VehicleInfo[veh3[playerid]][vLock] = dini_Int(file, "Lock");
 		VehicleInfo[veh3[playerid]][vLockBuyed] = dini_Int(file, "LockBuyed");
 		VehicleInfo[veh3[playerid]][vRentPrice] = dini_Int(file, "RentPrice");
		VehicleInfo[veh3[playerid]][vAlarm] = dini_Int(file, "Alarm");
 		IsOwned[veh3[playerid]] = 1;
		new sb[256]; format(sb, sizeof(sb), "Your %s has spawned in the place where you have parked it.", VehicleNames[GetVehicleModel(veh3[playerid])-400]); SendClientMessage(playerid, COLOR_YELLOW, sb);
		format(sb, sizeof(sb), "INFO: Model:[%s] |Owner:[%s] |Description:[%s] |LockLevel:[%d] |RentPrice: [$%d] |AlarmLevel:[%d]", VehicleNames[GetVehicleModel(veh3[playerid])-400], VehicleInfo[veh3[playerid]][vOwner], string,
		VehicleInfo[veh3[playerid]][vLock], VehicleInfo[veh3[playerid]][vRentPrice], VehicleInfo[veh3[playerid]][vAlarm]);
		SendClientMessage(playerid, COLOR_GREEN, sb);
		if(VehicleInfo[veh3[playerid]][vLock] > 0)
		{
			SetVehicleParamsForPlayer(veh3[playerid], 0, 0, 1);
			return 1;
		}
		return 1;
	}
	else if(strcmp(string, PlayerVehicle[playerid][pVeh4], true) == 0)
	{
		veh2[playerid] = CreateVehicle(dini_Int(file, "Model"), dini_Float(file, "ParkX"), dini_Float(file, "ParkY"), dini_Float(file, "ParkZ"), dini_Float(file, "ParkAngle"), dini_Int(file, "Color1"), dini_Int(file, "Color2"), 60000);
		strmid(VehicleInfo[veh4[playerid]][vOwner], dini_Get(file, "Owner"), 0, strlen(dini_Get(file, "Owner")), 255);
 		strmid(VehicleInfo[veh4[playerid]][vDescription], dini_Get(file, "Description"), 0, strlen(dini_Get(file, "Description")), 255);
		VehicleInfo[veh4[playerid]][vModel] = dini_Int(file, "Model");
		VehicleInfo[veh4[playerid]][vX] = dini_Float(file, "ParkX");
		VehicleInfo[veh4[playerid]][vY] = dini_Float(file, "ParkY");
		VehicleInfo[veh4[playerid]][vZ] = dini_Float(file, "ParkZ");
		VehicleInfo[veh4[playerid]][vAngle] = dini_Float(file, "ParkAngle");
		VehicleInfo[veh4[playerid]][vColorOne] = dini_Int(file, "color1");
		VehicleInfo[veh4[playerid]][vColorTwo] = dini_Int(file, "color2");
	 	VehicleInfo[veh4[playerid]][vOwned] = dini_Int(file, "Owned");
 		VehicleInfo[veh4[playerid]][vLock] = dini_Int(file, "Lock");
 		VehicleInfo[veh4[playerid]][vLockBuyed] = dini_Int(file, "LockBuyed");
 		VehicleInfo[veh4[playerid]][vRentPrice] = dini_Int(file, "RentPrice");
		VehicleInfo[veh4[playerid]][vAlarm] = dini_Int(file, "Alarm");
 		IsOwned[veh4[playerid]] = 1;
		new sb[256]; format(sb, sizeof(sb), "Your %s has spawned in the place where you have parked it.", VehicleNames[GetVehicleModel(veh4[playerid])-400]); SendClientMessage(playerid, COLOR_YELLOW, sb);
		format(sb, sizeof(sb), "INFO: Model:[%s] |Owner:[%s] |Description:[%s] |LockLevel:[%d] |RentPrice: [$%d] |AlarmLevel:[%d]", VehicleNames[GetVehicleModel(veh2[playerid])-400], VehicleInfo[veh2[playerid]][vOwner], string,
		VehicleInfo[veh4[playerid]][vLock], VehicleInfo[veh4[playerid]][vRentPrice], VehicleInfo[veh4[playerid]][vAlarm]);
		SendClientMessage(playerid, COLOR_GREEN, sb);
		if(VehicleInfo[veh4[playerid]][vLock] > 0)
		{
			SetVehicleParamsForPlayer(veh4[playerid], 0, 0, 1);
			return 1;
		}
		return 1;
	}
	else if(strcmp(string, PlayerVehicle[playerid][pVeh5], true) == 0)
	{
		veh5[playerid] = CreateVehicle(dini_Int(file, "Model"), dini_Float(file, "ParkX"), dini_Float(file, "ParkY"), dini_Float(file, "ParkZ"), dini_Float(file, "ParkAngle"), dini_Int(file, "Color1"), dini_Int(file, "Color2"), 60000);
		strmid(VehicleInfo[veh5[playerid]][vOwner], dini_Get(file, "Owner"), 0, strlen(dini_Get(file, "Owner")), 255);
 		strmid(VehicleInfo[veh5[playerid]][vDescription], dini_Get(file, "Description"), 0, strlen(dini_Get(file, "Description")), 255);
		VehicleInfo[veh5[playerid]][vModel] = dini_Int(file, "Model");
		VehicleInfo[veh5[playerid]][vX] = dini_Float(file, "ParkX");
		VehicleInfo[veh5[playerid]][vY] = dini_Float(file, "ParkY");
		VehicleInfo[veh5[playerid]][vZ] = dini_Float(file, "ParkZ");
		VehicleInfo[veh5[playerid]][vAngle] = dini_Float(file, "ParkAngle");
		VehicleInfo[veh5[playerid]][vColorOne] = dini_Int(file, "color1");
		VehicleInfo[veh5[playerid]][vColorTwo] = dini_Int(file, "color2");
	 	VehicleInfo[veh5[playerid]][vOwned] = dini_Int(file, "Owned");
 		VehicleInfo[veh5[playerid]][vLock] = dini_Int(file, "Lock");
 		VehicleInfo[veh5[playerid]][vLockBuyed] = dini_Int(file, "LockBuyed");
 		VehicleInfo[veh5[playerid]][vRentPrice] = dini_Int(file, "RentPrice");
		VehicleInfo[veh5[playerid]][vAlarm] = dini_Int(file, "Alarm");
 		IsOwned[veh5[playerid]] = 1;
		new sb[256]; format(sb, sizeof(sb), "Your %s has spawned in the place where you have parked it.", VehicleNames[GetVehicleModel(veh5[playerid])-400]); SendClientMessage(playerid, COLOR_YELLOW, sb);
		format(sb, sizeof(sb), "INFO: Model:[%s] |Owner:[%s] |Description:[%s] |LockLevel:[%d] |RentPrice: [$%d] |AlarmLevel:[%d]", VehicleNames[GetVehicleModel(veh5[playerid])-400], VehicleInfo[veh5[playerid]][vOwner], string,
		VehicleInfo[veh5[playerid]][vLock], VehicleInfo[veh5[playerid]][vRentPrice], VehicleInfo[veh5[playerid]][vAlarm]);
		SendClientMessage(playerid, COLOR_GREEN, sb);
		if(VehicleInfo[veh5[playerid]][vLock] > 0)
		{
			SetVehicleParamsForPlayer(veh5[playerid], 0, 0, 1);
			return 1;
		}
		return 1;
	}
	return 1;
}
Reply
#2

Hmm.. I tried adding printf("LoadVehicles 1 Loaded); but whenever I did /v get 1-5 it didn't show up in the log..
Reply
#3

Meh, another bump.
Reply
#4

Damn.. I REALLY need this fixed to finish off my gamemode.. anyone?
Reply
#5

Quote:
Originally Posted by Devine
Damn.. I REALLY need this fixed to finish off my gamemode.. anyone?
Reply
#6

Damn man, that's four posts in a row. Calm down, stop spamming this forum so badly...
Wait until you get your answer, a thread 6 replies only 1 from another user...

BTW: I'd try to help you but it's 2.32 am in here and im too tired to check the code you've posted lo lsorry ;0
Reply
#7

Any warnings?
Reply
#8

No warnings/errors.
Reply
#9

I'm sure it is to do with the command rather than the LoadVehicles...

It looks complicated/over complicated and I think that thats where it's failing/hard to read.
Reply
#10

Quote:
Originally Posted by Sew_Sumi
I'm sure it is to do with the command rather than the LoadVehicles...

It looks complicated/over complicated and I think that thats where it's failing/hard to read.
Do you have any suggestios for what to use?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)