SA-MP Forums Archive
How to do this, loops, functions - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to do this, loops, functions (/showthread.php?tid=628149)



How to do this, loops, functions - AndreiWow - 06.02.2017

How can I make a function out of this.

pvehicle[i] is the id of the vehicle, the way the vehicle is saved, example.

VehicleInfo[pvehicle[i]][vPlate];

And this is the test command
PHP код:
CMD:testcar(playeridparams[])
{
    new 
string[200];
    for(new 
iMAX_PVEHICLESi++)
    {
        
format(stringsizeof(string), "Vehicle ID: %d | Vehicle Type: %d, Plate: %s | Owner: %s"VehicleInfo[pvehicle[i]][ID], VehicleInfo[pvehicle[i]][vType], VehicleInfo[pvehicle[i]][vPlate], VehicleInfo[pvehicle[i]][vOwner] );
        
SCM(playeridCOLOR_YELLOWstring);
        break;
    }
    return 
1;

But how can I make this like.. not show 200 times also, can I make a function or something out of this so I don't have to make a loop everywhere I need the vehicle id?