[HELP] GetPlate Command
#1

Hey Guys,

Am trying to work on this /getplate command and somethings just not adding up on this. When I type /getplate it says something completly different to what the plate was set before, now if its any help the system make up random letters and numbers on the plate, heres a screenshot and the code of the full system including the cars:



pawn Код:
new CIVVehicles[101];

enum vInfo
{
    VehPlate[128]
}
new VehicleInfo[MAX_VEHICLES][vInfo];

public OnGamemodeInt()
{
CIVVehicles[0] = AddStaticVehicle(463,1292.4000000,345.7999900,19.2000000,60.0000000,-1,-1);
    CIVVehicles[1] = AddStaticVehicle(463,1291.6000000,343.7000100,19.2000000,59.9960000,-1,-1);
    CIVVehicles[2] = AddStaticVehicle(463,1290.7000000,341.7000100,19.2000000,59.9960000,-1,-1);
    CIVVehicles[3] = AddStaticVehicle(463,1289.9000000,339.7000100,19.2000000,59.9960000,-1,-1);
    CIVVehicles[4] = AddStaticVehicle(609,1239.1000000,210.8000000,19.8000000,154.0000000,-1,-1);
    CIVVehicles[5] = AddStaticVehicle(609,1234.6000000,213.0000000,19.8000000,153.9950000,-1,-1);
    CIVVehicles[6] = AddStaticVehicle(419,607.0999800,-507.2999900,16.3000000,0.0000000,-1,-1);
    CIVVehicles[7] = AddStaticVehicle(445,199.2000000,-156.3000000,1.6000000,0.0000000,-1,-1);
    CIVVehicles[8] = AddStaticVehicle(550,196.3000000,-156.2000000,1.5000000,0.0000000,-1,-1);
    CIVVehicles[9] = AddStaticVehicle(585,199.1000100,-148.2000000,1.3000000,0.0000000,-1,-1);
    CIVVehicles[10] = AddStaticVehicle(445,203.3999900,-148.2000000,1.6000000,0.0000000,-1,-1);
    CIVVehicles[11] = AddStaticVehicle(507,194.1000100,-140.3000000,1.5000000,0.0000000,-1,-1);
    CIVVehicles[12] = AddStaticVehicle(566,218.1000100,-140.6000100,1.5000000,0.0000000,-1,-1);
    CIVVehicles[13] = AddStaticVehicle(566,211.8999900,-140.3999900,1.5000000,0.0000000,-1,-1);
    CIVVehicles[14] = AddStaticVehicle(529,251.8999900,-159.8999900,1.3000000,0.0000000,-1,-1);
    CIVVehicles[15] = AddStaticVehicle(551,259.2000100,-149.3000000,1.5000000,272.0000000,-1,-1);
    CIVVehicles[16] = AddStaticVehicle(552,94.4000000,-172.3999900,1.8000000,270.0000000,-1,-1);
    CIVVehicles[17] = AddStaticVehicle(552,96.2000000,-165.1000100,2.4000000,270.0000000,-1,-1);
    CIVVehicles[18] = AddStaticVehicle(552,96.1000000,-154.5000000,2.4000000,270.0000000,-1,-1);
    CIVVehicles[19] = AddStaticVehicle(552,112.5000000,-178.0000000,1.3000000,270.0000000,-1,-1);
    CIVVehicles[20] = AddStaticVehicle(478,157.3000000,-174.8999900,1.7000000,0.0000000,-1,-1);
    CIVVehicles[21] = AddStaticVehicle(549,158.6000100,-163.3000000,1.4000000,92.0000000,-1,-1);
    CIVVehicles[22] = AddStaticVehicle(576,169.8000000,-7.5000000,1.3000000,0.0000000,-1,-1);
    CIVVehicles[23] = AddStaticVehicle(585,176.3999900,-7.9000000,1.3000000,0.0000000,-1,-1);
    CIVVehicles[24] = AddStaticVehicle(492,183.1000100,-8.1000000,1.5000000,0.0000000,-1,-1);
    CIVVehicles[25] = AddStaticVehicle(566,190.0000000,-8.3000000,1.5000000,0.0000000,-1,-1);
    CIVVehicles[26] = AddStaticVehicle(550,-120.8000000,1136.2000000,19.7000000,0.0000000,-1,-1);
    CIVVehicles[27] = AddStaticVehicle(516,-124.7000000,1135.8000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[28] = AddStaticVehicle(536,-128.7000000,1135.8000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[29] = AddStaticVehicle(412,-176.8000000,1217.0000000,19.7000000,268.0000000,-1,-1);
    CIVVehicles[30] = AddStaticVehicle(535,-177.1000100,1222.5000000,19.6000000,270.0000000,-1,-1);
    CIVVehicles[31] = AddStaticVehicle(542,-156.7000000,1227.5000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[32] = AddStaticVehicle(439,-103.8000000,1221.7000000,19.7000000,0.0000000,-1,-1);
    CIVVehicles[33] = AddStaticVehicle(526,-99.0000000,1221.8000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[34] = AddStaticVehicle(517,-94.2000000,1221.7000000,19.7000000,0.0000000,-1,-1);
    CIVVehicles[35] = AddStaticVehicle(491,-89.5000000,1222.1000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[36] = AddStaticVehicle(401,-84.4000000,1222.0000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[37] = AddStaticVehicle(526,-79.1000000,1222.1000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[38] = AddStaticVehicle(439,-27.5000000,1166.6000000,19.4000000,0.0000000,-1,-1);
    CIVVehicles[39] = AddStaticVehicle(474,-31.0000000,1166.7000000,19.3000000,0.0000000,-1,-1);
    CIVVehicles[40] = AddStaticVehicle(491,-34.4000000,1166.6000000,19.3000000,0.0000000,-1,-1);
    CIVVehicles[41] = AddStaticVehicle(419,-37.8000000,1166.6000000,19.4000000,0.0000000,-1,-1);
    CIVVehicles[42] = AddStaticVehicle(401,-41.4000000,1166.4000000,19.4000000,0.0000000,-1,-1);
    CIVVehicles[43] = AddStaticVehicle(562,-48.2000000,1166.3000000,19.3000000,0.0000000,-1,-1);
    CIVVehicles[44] = AddStaticVehicle(533,-51.5000000,1166.4000000,19.4000000,0.0000000,-1,-1);
    CIVVehicles[45] = AddStaticVehicle(567,23.1000000,1165.1000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[46] = AddStaticVehicle(575,16.4000000,1165.1000000,19.3000000,0.0000000,-1,-1);
    CIVVehicles[47] = AddStaticVehicle(421,12.8000000,1165.0000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[48] = AddStaticVehicle(576,6.1000000,1165.0000000,19.4000000,0.0000000,-1,-1);
    CIVVehicles[49] = AddStaticVehicle(547,676.4000200,1946.6000000,5.4000000,0.0000000,-1,-1);
    CIVVehicles[50] = AddStaticVehicle(540,681.5000000,1946.2000000,5.5000000,0.0000000,-1,-1);
    CIVVehicles[51] = AddStaticVehicle(412,686.5000000,1946.6000000,5.5000000,0.0000000,-1,-1);
    CIVVehicles[52] = AddStaticVehicle(436,691.2999900,1946.7000000,5.4000000,0.0000000,-1,-1);
    CIVVehicles[53] = AddStaticVehicle(558,696.2000100,1946.8000000,5.2000000,0.0000000,-1,-1);
    CIVVehicles[54] = AddStaticVehicle(562,701.7000100,1947.2000000,5.3000000,0.0000000,-1,-1);
    CIVVehicles[55] = AddStaticVehicle(491,706.0000000,1946.0000000,5.4000000,0.0000000,-1,-1);
    CIVVehicles[56] = AddStaticVehicle(549,711.0999800,1946.6000000,5.4000000,0.0000000,-1,-1);
    CIVVehicles[57] = AddStaticVehicle(467,716.0999800,1946.6000000,5.4000000,0.0000000,-1,-1);
    CIVVehicles[58] = AddStaticVehicle(546,726.2999900,1947.0000000,5.4000000,0.0000000,-1,-1);
    CIVVehicles[59] = AddStaticVehicle(467,-280.2999900,2685.8999000,62.5000000,0.0000000,-1,-1);
    CIVVehicles[60] = AddStaticVehicle(551,-270.5000000,2675.1001000,62.5000000,270.0000000,-1,-1);
    CIVVehicles[61] = AddStaticVehicle(566,-233.7000000,2730.5000000,62.6000000,0.0000000,-1,-1);
    CIVVehicles[62] = AddStaticVehicle(540,-229.2000000,2730.3999000,62.7000000,0.0000000,-1,-1);
    CIVVehicles[63] = AddStaticVehicle(467,-224.7000000,2730.5000000,62.6000000,0.0000000,-1,-1);
    CIVVehicles[64] = AddStaticVehicle(534,-220.3000000,2729.5000000,62.5000000,0.0000000,-1,-1);
    CIVVehicles[65] = AddStaticVehicle(576,-214.7000000,2730.2000000,62.4000000,0.0000000,-1,-1);
    CIVVehicles[66] = AddStaticVehicle(542,-208.8000000,2730.3999000,62.5000000,0.0000000,-1,-1);
    CIVVehicles[67] = AddStaticVehicle(439,-204.1000100,2730.3000000,62.7000000,0.0000000,-1,-1);
    CIVVehicles[68] = AddStaticVehicle(475,-200.0000000,2730.3999000,62.6000000,0.0000000,-1,-1);
    CIVVehicles[69] = AddStaticVehicle(542,-1275.7000000,2705.7000000,49.9000000,28.0000000,-1,-1);
    CIVVehicles[70] = AddStaticVehicle(567,-1270.3000000,2708.7000000,50.0000000,28.0000000,-1,-1);
    CIVVehicles[71] = AddStaticVehicle(439,-1264.3000000,2711.8000000,50.1000000,30.0000000,-1,-1);
    CIVVehicles[72] = AddStaticVehicle(576,-1258.9000000,2715.3000000,49.8000000,32.0000000,-1,-1);
    CIVVehicles[73] = AddStaticVehicle(466,-1420.1000000,2618.3999000,55.8000000,0.0000000,-1,-1);
    CIVVehicles[74] = AddStaticVehicle(550,-1421.0000000,2627.7000000,55.6000000,0.0000000,-1,-1);
    CIVVehicles[75] = AddStaticVehicle(516,-1420.6000000,2655.6001000,55.7000000,0.0000000,-1,-1);
    CIVVehicles[76] = AddStaticVehicle(467,-1476.6000000,2656.0000000,55.7000000,0.0000000,-1,-1);
    CIVVehicles[77] = AddStaticVehicle(566,-1522.3000000,2585.0000000,55.7000000,0.0000000,-1,-1);
    CIVVehicles[78] = AddStaticVehicle(516,-1490.8000000,2581.6001000,55.7000000,0.0000000,-1,-1);
    CIVVehicles[79] = AddStaticVehicle(547,-1490.7000000,2567.0000000,55.7000000,0.0000000,-1,-1);
    CIVVehicles[80] = AddStaticVehicle(546,-1532.1000000,2570.3999000,55.7000000,94.0000000,-1,-1);
    CIVVehicles[81] = AddStaticVehicle(546,-1540.0000000,2582.8000000,55.7000000,0.0000000,-1,-1);
    CIVVehicles[82] = AddStaticVehicle(576,-1540.1000000,2623.8000000,55.6000000,0.0000000,-1,-1);
    CIVVehicles[83] = AddStaticVehicle(535,-1520.8000000,2630.2000000,55.7000000,0.0000000,-1,-1);
    CIVVehicles[84] = AddStaticVehicle(540,-1524.6000000,2630.3999000,55.8000000,0.0000000,-1,-1);
    CIVVehicles[85] = AddStaticVehicle(540,-1529.5000000,2627.3000000,55.8000000,0.0000000,-1,-1);
    CIVVehicles[86] = AddStaticVehicle(423,-777.7000100,1640.0000000,27.2000000,296.0000000,-1,-1);
    CIVVehicles[87] = AddStaticVehicle(423,-761.0999800,1644.6000000,27.6000000,295.9990000,-1,-1);
    CIVVehicles[88] = AddStaticVehicle(588,-769.2000100,1640.8000000,26.4000000,240.0000000,-1,-1);
    CIVVehicles[89] = AddStaticVehicle(588,-748.5000000,1640.8000000,26.2000000,239.9960000,-1,-1);
    CIVVehicles[90] = AddStaticVehicle(531,-738.5000000,1576.9000000,27.2000000,0.0000000,-1,-1);
    CIVVehicles[91] = AddStaticVehicle(540,-865.5000000,1563.4000000,24.5000000,270.0000000,-1,-1);
    CIVVehicles[92] = AddStaticVehicle(445,-865.4000200,1557.3000000,24.1000000,272.0000000,-1,-1);
    CIVVehicles[93] = AddStaticVehicle(421,-865.7000100,1551.0000000,23.5000000,270.0000000,-1,-1);
    CIVVehicles[94] = AddStaticVehicle(492,-865.5999800,1544.8000000,22.9000000,272.0000000,-1,-1);
    CIVVehicles[95] = AddStaticVehicle(426,-820.9000200,1443.8000000,13.6000000,0.0000000,-1,-1);
    CIVVehicles[96] = AddStaticVehicle(566,-222.7000000,1164.9000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[97] = AddStaticVehicle(546,-163.8000000,1028.4000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[98] = AddStaticVehicle(580,-164.6000100,1012.3000000,19.6000000,0.0000000,-1,-1);
    CIVVehicles[99] = AddStaticVehicle(529,-168.5000000,1012.2000000,19.5000000,0.0000000,-1,-1);
    CIVVehicles[100] = AddStaticVehicle(405,-166.8798800,1011.9521500,19.2421900,0.0000000,-1,-1);

    for(new x;x<sizeof(CIVVehicles);x++)
    {
        format(string,sizeof(string),"%c%c%c %i%i%i",(65+random(26)),(65+random(26)),(65+random(26)),random(10),random(10),random(10));
        SetVehicleNumberPlate(CIVVehicles[x], string);
        SetVehicleToRespawn(CIVVehicles[x]);
        VehicleInfo[x][VehPlate] = string;
    }
return 1;
}

CMD:getplate(playerid, params[])
{
    new Veh = GetPlayerVehicleID(playerid);
    new plate = VehicleInfo[Veh][VehPlate];
    format(msg, sizeof(msg), "PLATE: %s", plate);
    SendClientMessage(playerid, COLOR_GREY, msg);
    return 1;
}
Reply
#2

I forgot to mention that when I go to other cars it has something different, tested one and its plate was "NNA 971" and when I used the command it shows as "E,"
Reply
#3

First of all on command getplate you didn't create string msg but that isn't the initial problem hear. You made enum VehPlate couse you tought that it will contain number of vehicle license plate, but enums are empty strings.
And you CAN'T get number of vehicle plate, you can just set it. Here is the link of setting number of vehicle plate: https://sampwiki.blast.hk/wiki/SetVehicleNumberPlate
Reply
#4

You can't store a string inside one variable like that
pawn Код:
new plate = VehicleInfo[Veh][VehPlate];
format(msg, sizeof(msg), "PLATE: %s", plate);
That will only save the first character in 'plate'

Just leave the variable away and it should be working
pawn Код:
format(msg, sizeof(msg), "PLATE: %s", VehicleInfo[Veh][VehPlate]);
Reply
#5

I have seen gamemodes that have had it, like in game but there is a way and am trying to make a way for it!
Reply
#6

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
You can't store a string inside one variable like that
pawn Код:
new plate = VehicleInfo[Veh][VehPlate];
format(msg, sizeof(msg), "PLATE: %s", plate);
That will only save the first character in 'plate'

Just leave the variable away and it should be working
pawn Код:
format(msg, sizeof(msg), "PLATE: %s", VehicleInfo[Veh][VehPlate]);
That works much better but its getting itself mixing the plates up with other vehicle ID's now, any ideas on how to fix that?
Reply
#7

I also found a pattern in this, when I go to a car say that has id 40, it takes the car id 41 insted and keeps doing this for every car, so each cars plate it saves it saves it one higher than the other.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)