License plate
#1

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

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;
}
Reply
#3

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;
}
Reply
#4

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?
Reply
#5

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.
Reply
#6

thank you
Reply
#7

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

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

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)