Random trailer
#1

Can someone fix this 2 errors

pawn Код:
#include <a_samp>
#include <zcmd>
#define COLOR_RED 0xff0000a7

new Trailers[][] =
{{435},
{450},
{591},
{584}};

CMD:trailer(playerid, params[])
{
    new vehicleid;
    new randomtrailer;
    vehicleid = GetPlayerVehicleID(playerid);
    if(IsATruck(vehicleid))
    {
        new randtrailer = random( sizeof( Trailers ) );
        AttachTrailerToVehicle(CreateVehicle(randomtrailer, 0.0, 0.0, 0.0, 0.0, -1, -1, 60) , vehicleid);

    }
    return 1;
}

stock IsATruck(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
        case 403, 514, 515: return 1;
    }
    return 0;
}
Код:
(19) : warning 204: symbol is assigned a value that is never used: "randtrailer"
(34) : warning 203: symbol is never used: "Trailers"
Reply
#2

remove
pawn Код:
new randomtrailer;
pawn Код:
//change
AttachTrailerToVehicle(CreateVehicle(randomtrailer, 0.0, 0.0, 0.0, 0.0, -1, -1, 60) , vehicleid);
//to
AttachTrailerToVehicle(CreateVehicle(Trailers[randtrailer][0], 0.0, 0.0, 0.0, 0.0, -1, -1, 60) , vehicleid);
One question though? Why multidimensional array? If you won't add any new info, change it simply to one dimensional.
Reply
#3

Still nothing happens

pawn Код:
#include <a_samp>
#include <zcmd>
#define COLOR_RED 0xff0000a7

new Trailers[][] =
{{435},
{450},
{591},
{584}};

CMD:trailer(playerid, params[])
{
    new vehicleid;
   
    vehicleid = GetPlayerVehicleID(playerid);
    if(IsATruck(vehicleid))
    {
        new randtrailer = random( sizeof( Trailers ) );
       
        AttachTrailerToVehicle(CreateVehicle(Trailers[randtrailer][0], 0.0, 0.0, 0.0, 0.0, -1, -1, 60) , vehicleid);
    }
    return 1;
}

stock IsATruck(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
        case 403, 514, 515: return 1;
    }
    return 0;
}
Reply
#4

Please can someone fix this
Reply
#5

Why do you even need the two dimensional array? You only have one dimension.
Reply
#6

what
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)