Command to see vehicles you possess, doesn't work.
#1

Hello, when I type this command (it should display the vehicles you own in my vehicle system), it says "you own these vehicles:" and then SERVER: Unknown Command.
I don't know why I've revised the script for the midnight and can't find any leaks (because I'm not too aware at the moment).

pawn Код:
CMD:vehicles( playerid, params[] )
{
    SendClientMessage( playerid, -1, "You own these vehicles:");

    new szString[128];
    new carkey1 = PlayerInfo[playerid][VehKey1];
    new carkey2 = PlayerInfo[playerid][VehKey2];
    new carkey3 = PlayerInfo[playerid][VehKey3];
    new carkey4 = PlayerInfo[playerid][VehKey4];
    new carkey5 = PlayerInfo[playerid][VehKey5];

    if ( carkey1 != 255 )
    {
        format( szString, 128, "{6699cc}[Vehicle 1]:{ffffff} [Key: %d] [Name: %s] [Cost: %d] [Color 1: %d] [Color 2: %d] [ImpoundCost: %d] [Insurances: %d] [GPS: %d]", carkey1, GetVehicleName( VehicleInfo[carkey1][Model] ), VehicleInfo[carkey1][Cost], VehicleInfo[carkey1][Color1], VehicleInfo[carkey1][Color2], VehicleInfo[carkey1][ImpoundCost], VehicleInfo[carkey1][Insurances], VehicleInfo[carkey1][GPS] );
        SendClientMessage( playerid, -1, szString );
    }

    if ( carkey2 != 255 )
    {
        format( szString, 128, "{6699cc}[Vehicle 2]:{ffffff} [Key: %d] [Name: %s] [Cost: %d] [Color 1: %d] [Color 2: %d] [ImpoundCost: %d] [Insurances: %d] [GPS: %d]", carkey2, GetVehicleName( VehicleInfo[carkey2][Model] ), VehicleInfo[carkey2][Cost], VehicleInfo[carkey2][Color1], VehicleInfo[carkey2][Color2], VehicleInfo[carkey2][ImpoundCost], VehicleInfo[carkey2][Insurances], VehicleInfo[carkey2][GPS] );
        SendClientMessage( playerid, -1, szString );
    }

    if ( carkey3 != 255 )
    {
        format( szString, 128, "{6699cc}[Vehicle 3]:{ffffff} [Key: %d] [Name: %s] [Cost: %d] [Color 1: %d] [Color 2: %d] [ImpoundCost: %d] [Insurances: %d] [GPS: %d]", carkey3, GetVehicleName( VehicleInfo[carkey3][Model] ), VehicleInfo[carkey3][Cost], VehicleInfo[carkey3][Color1], VehicleInfo[carkey3][Color2], VehicleInfo[carkey3][ImpoundCost], VehicleInfo[carkey3][Insurances], VehicleInfo[carkey3][GPS] );
        SendClientMessage( playerid, -1, szString );
    }

    if ( carkey4 != 255 )
    {
        format( szString, 128, "{6699cc}[Vehicle 4]:{ffffff} [Key: %d] [Name: %s] [Cost: %d] [Color 1: %d] [Color 2: %d] [ImpoundCost: %d] [Insurances: %d] [GPS: %d]", carkey4, GetVehicleName( VehicleInfo[carkey4][Model] ), VehicleInfo[carkey4][Cost], VehicleInfo[carkey4][Color1], VehicleInfo[carkey4][Color2], VehicleInfo[carkey4][ImpoundCost], VehicleInfo[carkey4][Insurances], VehicleInfo[carkey4][GPS] );
        SendClientMessage( playerid, -1, szString );
    }

    if ( carkey5 != 255 )
    {
        format( szString, 128, "{6699cc}[Vehicle 5]:{ffffff} [Key: %d] [Name: %s] [Cost: %d] [Color 1: %d] [Color 2: %d] [ImpoundCost: %d] [Insurances: %d] [GPS: %d]", carkey5, GetVehicleName( VehicleInfo[carkey5][Model] ), VehicleInfo[carkey5][Cost], VehicleInfo[carkey5][Color1], VehicleInfo[carkey5][Color2], VehicleInfo[carkey5][ImpoundCost], VehicleInfo[carkey5][Insurances], VehicleInfo[carkey5][GPS] );
        SendClientMessage( playerid, -1, szString );
    }

    SendClientMessage( playerid, 0x6699ccff, "______________________________________________");

    return 1;
}
Thanks for the help!
Reply
#2

pawn Код:
CMD:vehicles( playerid, params[] )
{
    SendClientMessage( playerid, -1, "You own these vehicles:");

    new szString[256],carkey;
    for(new i = 1; i < 6; i++)
    {
        if(i == 1) { carkey = PlayerInfo[playerid][VehKey1]; }
        else if(i == 2) { carkey = PlayerInfo[playerid][VehKey2]; }
        else if(i == 3) { carkey = PlayerInfo[playerid][VehKey3]; }
        else if(i == 4) { carkey = PlayerInfo[playerid][VehKey4]; }
        else if(i == 5) { carkey = PlayerInfo[playerid][VehKey5]; }
        if(carkey != 255)
        {
            format( szString, 256, "{6699cc}[Vehicle %d]:{ffffff} [Key: %d] [Name: %s] [Cost: %d] [Color 1: %d] [Color 2: %d] [ImpoundCost: %d] [Insurances: %d] [GPS: %d]", i, carkey, GetVehicleName( VehicleInfo[carkey][Model] ), VehicleInfo[carkey][Cost], VehicleInfo[carkey][Color1], VehicleInfo[carkey][Color2], VehicleInfo[carkey][ImpoundCost], VehicleInfo[carkey][Insurances], VehicleInfo[carkey][GPS] );
            SendClientMessage( playerid, -1, szString );
        }
    }
    SendClientMessage( playerid, 0x6699ccff, "______________________________________________");
    return 1;
}
I guess you can try that..

EDIT:

You could've done this in playerinfo enum: VehKey[5], the use of that would be PlayerInfo[playerid][VehKey][0-4]

Just a suggestion
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)