/v list not showing correctly -
Mikkel_RE - 06.10.2015
Hello, i am having a vehicle system, which allows you to own 5 vehicles, and get a list of your vehicles by typing "/v list" but if i dont have 5 vehicles, but 1,2,3 or 4 vehicles it will show the list and "SERVER: Unknown Command" appears under the list.. And, if i own 5 vehicles and sell...lets say.. vehicle number 3, and then type /v list, it will only show vehicle number 1 and number 2. I hope you Guys can help me
Ps. sorry for my bad English :P
pawn Код:
if(strcmp(x_job,"list",true) == 0)
{
for(new i = 0; i < sizeof(CarInfo); i++)
{
if(PlayerInfo[playerid][pCarkey] == SCRIPT_CARS)
if(PlayerInfo[playerid][pCarkey2] == SCRIPT_CARS)
if(PlayerInfo[playerid][pCarkey3] == SCRIPT_CARS)
if(PlayerInfo[playerid][pCarkey4] == SCRIPT_CARS)
if(PlayerInfo[playerid][pCarkey5] == SCRIPT_CARS)
{
SendClientMessage(playerid,COLOR_GREY,"No vehicles found.");
return 1;
}
new carkey = PlayerInfo[playerid][pCarkey],carkey2 = PlayerInfo[playerid][pCarkey2],carkey3 = PlayerInfo[playerid][pCarkey3],carkey4 = PlayerInfo[playerid][pCarkey4],carkey5 = PlayerInfo[playerid][pCarkey5];
format(string, sizeof(string), ""COL_GREY"1. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey][cDescription], CarInfo[carkey][cValue], CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cLock],CarInfo[carkey][cImpounded],CarInfo[carkey][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY,string);
format(string, sizeof(string), ""COL_GREY"2. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey2][cDescription], CarInfo[carkey2][cValue], CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cLock],CarInfo[carkey2][cImpounded],CarInfo[carkey2][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY,string);
format(string, sizeof(string), ""COL_GREY"3. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey3][cDescription], CarInfo[carkey3][cValue], CarInfo[carkey3][cColorOne], CarInfo[carkey3][cColorTwo], CarInfo[carkey3][cLock],CarInfo[carkey3][cImpounded],CarInfo[carkey3][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY,string);
format(string, sizeof(string), ""COL_GREY"4. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey4][cDescription], CarInfo[carkey4][cValue], CarInfo[carkey4][cColorOne], CarInfo[carkey4][cColorTwo], CarInfo[carkey4][cLock],CarInfo[carkey4][cImpounded],CarInfo[carkey4][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY,string);
format(string, sizeof(string), ""COL_GREY"5. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey5][cDescription], CarInfo[carkey5][cValue], CarInfo[carkey5][cColorOne], CarInfo[carkey5][cColorTwo], CarInfo[carkey5][cLock],CarInfo[carkey5][cImpounded],CarInfo[carkey5][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY,string);
return 1;
}
}
Re: /v list not showing correctly -
Dusan01 - 07.10.2015
in that case u should do a check does he have vehicle number 1 or 2 or 3...
Код:
if (strcmp(x_job, "list", true) == 0) {
for (new i = 0; i < sizeof(CarInfo); i++) {
if (PlayerInfo[playerid][pCarkey] == SCRIPT_CARS)
if (PlayerInfo[playerid][pCarkey2] == SCRIPT_CARS)
if (PlayerInfo[playerid][pCarkey3] == SCRIPT_CARS)
if (PlayerInfo[playerid][pCarkey4] == SCRIPT_CARS)
if (PlayerInfo[playerid][pCarkey5] == SCRIPT_CARS) {
SendClientMessage(playerid, COLOR_GREY, "No vehicles found.");
return 1;
}
new carkey = PlayerInfo[playerid][pCarkey],
carkey2 = PlayerInfo[playerid][pCarkey2],
carkey3 = PlayerInfo[playerid][pCarkey3],
carkey4 = PlayerInfo[playerid][pCarkey4],
carkey5 = PlayerInfo[playerid][pCarkey5];
if (PlayerInfo[playerid][pCarkey] != -1) {
format(string, sizeof(string), ""COL_GREY"1. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey][cDescription], CarInfo[carkey][cValue], CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cLock], CarInfo[carkey][cImpounded], CarInfo[carkey][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[playerid][pCarkey2] != -1) {
format(string, sizeof(string), ""COL_GREY"2. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey2][cDescription], CarInfo[carkey2][cValue], CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cLock], CarInfo[carkey2][cImpounded], CarInfo[carkey2][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[playerid][pCarkey3] != -1) {
format(string, sizeof(string), ""COL_GREY"3. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey3][cDescription], CarInfo[carkey3][cValue], CarInfo[carkey3][cColorOne], CarInfo[carkey3][cColorTwo], CarInfo[carkey3][cLock], CarInfo[carkey3][cImpounded], CarInfo[carkey3][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[playerid][pCarkey4] != -1) {
format(string, sizeof(string), ""COL_GREY"4. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey4][cDescription], CarInfo[carkey4][cValue], CarInfo[carkey4][cColorOne], CarInfo[carkey4][cColorTwo], CarInfo[carkey4][cLock], CarInfo[carkey4][cImpounded], CarInfo[carkey4][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[playerid][pCarkey5] != -1) {
format(string, sizeof(string), ""COL_GREY"5. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey5][cDescription], CarInfo[carkey5][cValue], CarInfo[carkey5][cColorOne], CarInfo[carkey5][cColorTwo], CarInfo[carkey5][cLock], CarInfo[carkey5][cImpounded], CarInfo[carkey5][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
}
try like that, just edit what is default value for not having a car, in this code i put -1
Re: /v list not showing correctly -
Mikkel_RE - 07.10.2015
Ohh yeah thanks alot, i have already tried with if (PlayerInfo[playerid][pCarkey4] != 255) {
And that didnt Work, so i was thinking that something else was wrong... im stupid
Thanks alot for helping me
I also got this one working
pawn Код:
if (strcmp(x_job, "list", true) == 0) {
for (new i = 0; i < sizeof(CarInfo); i++) {
if (PlayerInfo[playerid][pCarkey] == SCRIPT_CARS)
if (PlayerInfo[playerid][pCarkey2] == SCRIPT_CARS)
if (PlayerInfo[playerid][pCarkey3] == SCRIPT_CARS)
if (PlayerInfo[playerid][pCarkey4] == SCRIPT_CARS)
if (PlayerInfo[playerid][pCarkey5] == SCRIPT_CARS) {
SendClientMessage(playerid, COLOR_GREY, "No vehicles found.");
return 1;
}
new carkey = PlayerInfo[playerid][pCarkey],
carkey2 = PlayerInfo[playerid][pCarkey2],
carkey3 = PlayerInfo[playerid][pCarkey3],
carkey4 = PlayerInfo[playerid][pCarkey4],
carkey5 = PlayerInfo[playerid][pCarkey5];
if (PlayerInfo[playerid][pCarkey] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"1. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey][cDescription], CarInfo[carkey][cValue], CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cLock], CarInfo[carkey][cImpounded], CarInfo[carkey][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[playerid][pCarkey2] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"2. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey2][cDescription], CarInfo[carkey2][cValue], CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cLock], CarInfo[carkey2][cImpounded], CarInfo[carkey2][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[playerid][pCarkey3] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"3. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey3][cDescription], CarInfo[carkey3][cValue], CarInfo[carkey3][cColorOne], CarInfo[carkey3][cColorTwo], CarInfo[carkey3][cLock], CarInfo[carkey3][cImpounded], CarInfo[carkey3][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[playerid][pCarkey4] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"4. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey4][cDescription], CarInfo[carkey4][cValue], CarInfo[carkey4][cColorOne], CarInfo[carkey4][cColorTwo], CarInfo[carkey4][cLock], CarInfo[carkey4][cImpounded], CarInfo[carkey4][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
if (PlayerInfo[playerid][pCarkey5] != SCRIPT_CARS) {
format(string, sizeof(string), ""COL_GREY"5. {FF6347}%s"COL_GREY" Value[%d] Color 1[%d] Color 2[%d] Locked[%d] Impounded[%d] Impound Price[%d]", CarInfo[carkey5][cDescription], CarInfo[carkey5][cValue], CarInfo[carkey5][cColorOne], CarInfo[carkey5][cColorTwo], CarInfo[carkey5][cLock], CarInfo[carkey5][cImpounded], CarInfo[carkey5][cImpoundedPrice]);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
}
Re: /v list not showing correctly -
Dusan01 - 07.10.2015
NP dude