[help] making a simple marco
#1

im trying to understand this , so please forgive me

i got a bunch of stocks that i think i should convert to marcos.

first off tell me if theres no advantage to converting these stocks,
and second if you can help me convert 1 stock I can learn from that and do the rest(hopefully) lol

so i got this stock

pawn Код:
stock IsASemi(vid){
    switch(vid)
    {
        case 403,514,515,443:return 1;
    }
    return 0;
}
and heres my marco for it
pawn Код:
#define IsASemi(%0)  \
        if((%0) == 403 || (%0) == 514 || (%0) == 515 || (%0) == 443){ return 1;}
im not sure if i should use the switch case or the if.. statement.
they both do the same thing but having a hard time getting the marco to work

i got this messed up!!
all my other stocks are very similar
so should be easy to convert after i see how this one is done,


thanks for the help
Reply
#2

Код:
#define IsASemi(%0)  \
        ((%0) == 403 || (%0) == 514 || (%0) == 515 || (%0) == 443)
Example:
Код:
CMD:issemi( playerid, params[ ] )
{
    if( IsSemi( GetVehicleModel( GetPlayerVehicleID( playerid ) ) ) ) 
        return SendClientMessage( playerid, -1, "You have a semi !" );

    SendClientMessage( playerid, -1, "You don't have a semi !" );
    return 1;
}
Reply
#3

awesome that works!!!

i see what went wrong,
the output i would have had would have been 2 nested if's
one without a condition


thank you for the help,
id +rep ya if i could
regards,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)