SA-MP Forums Archive
License plate - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: License plate (/showthread.php?tid=211672)



License plate - LZLo - 15.01.2011

how can i plate my vehs for example the firs EX-01, the second: EX-02 etc.
/without getting the vehicle ids/


Re: License plate - California - 15.01.2011

Well, you have to use OnVehicleSpawn, and it is impossible to not use the vehicle id's, then you'd have to do it manually which will take an estimated hour with over 100 vehicles.

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new license[8];
    format(license, sizeof(license), "EX-0%i", vehicleid);
    SetVehicleNumberPlate(vehicleid, license);
    SetVehicleToRespawn(vehicleid);
    return 1;
}



Re: License plate - hanzen - 15.01.2011

This should work:
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new
        lString[8] // max string for plates is 32.
    ;
    for(new i=0; i<MAX_VEHICLES; i++)
    {
        format(lString, sizeof(lString), "EX-%i", i);
        SetVehicleNumberPlate(vehicleid, lString);
        SetVehicleToRespawn(vehicleid);
    }
    return 1;
}



Re: License plate - California - 15.01.2011

Quote:
Originally Posted by hanzen
Посмотреть сообщение
This should work:
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new
        lString[8] // max string for plates is 32.
    ;
    for(new i=0; i<MAX_VEHICLES; i++)
    {
        format(lString, sizeof(lString), "EX-%i", i);
        SetVehicleNumberPlate(vehicleid, lString);
        SetVehicleToRespawn(vehicleid);
    }
    return 1;
}
You don't even need a loop, not even once. If one vehicle spawns, then it loops through all vehicles in the server just to get the vehicleid? Have you noticed the parameter?


Re: License plate - hanzen - 15.01.2011

Quote:
Originally Posted by California
Посмотреть сообщение
You don't even need a loop, not even once. If one vehicle spawns, then it loops through all vehicles in the server just to get the vehicleid? Have you noticed the parameter?
True, but you don't need to call this underneath OnVehicleSpawn() btw.

Editing your poster after you noticed that you excluded SetVehicleToRespawn() without even a notice, just to make you look better. Is retarded in itself.


Re: License plate - LZLo - 15.01.2011

thank you


Re: License plate - California - 15.01.2011

pawn Код:
if(Flaming[posterid] == true)
{
    Flaming[posterid] = false;
    Infract(posterid, "No flaming", 10);
    return 1;
}



Re: License plate - hanzen - 15.01.2011

You could rather just call this underneath OnGameModeInit() with the loop and exclude the respawn.


Re: License plate - California - 15.01.2011

Quote:
Originally Posted by hanzen
Посмотреть сообщение
You could rather just call this underneath OnGameModeInit() with the loop and exclude the respawn.
This is an even better idea, thanks for the tip.

p.s. yes I am a retard for editing that post, my bad lol


Re: License plate - hanzen - 15.01.2011

Quote:
Originally Posted by California
Посмотреть сообщение
This is an even better idea, thanks for the tip.

p.s. yes I am a retard for editing that post, my bad lol
You are allowed to edit it as long as you make a notice about it.