Function that return more than 1 value.
#1

hi all, i need little help, how to make function like for example GetPlayerPos(x,y,z);
and it makes x=5 y=6 z=7 its just an example, how to that?
Reply
#2

Use globals or pass refrences.

Global:

pawn Код:
new
    a = 1;

myFunc()
{
    a = 5;
}
Reference:

pawn Код:
new
    a = 1;

myFunc(&blah)
{
    blah = 5;
}

// usage
myFunc(a);
Reply
#3

thanks man, i put your name in credit
Reply
#4

pawn Код:
stock GetVehicleTrailerPos(vehicleid, trailerid, &Float:x, &Float:y, &Float:z){
    if(IsTrailerAttachedToVehicle(vehicleid)){
        if(GetVehicleTrailer(vehicleid) == trailerid){
            GetVehiclePos(trailerid, x, y, z);
            return 1;
        }else{
            return 0;
        }
    }else{
        return 0;
    }
}
so is this ok?
Reply
#5

Can you please explain me why is there vehicleid and trailerid, if you get the trailer's ID and then check it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)