SA-MP Forums Archive
ID's assignment - 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: Discussion (https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: ID's assignment (/showthread.php?tid=374542)



ID's assignment - Misiur - 03.09.2012

Hello there. Run the following code:
pawn Code:
public OnGameModeInit() {
    new a, Text:b, Text3D:c, Menu:d;
    a = CreateObject(123, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    printf("Object: %d\n", a);
    a = CreateVehicle(400, 0.0, 0.0, 0.0, 0.0, -1, -1, 0);
    printf("Car: %d\n", a);
    b = TextDrawCreate(1.0, 1.0, "Pancakes");
    printf("Text 2D: %d\n", _:b);
    c = Create3DTextLabel("Wat", 0xFFFFFFFF, 1.0, 1.0, 1.0, 1.0, 0, 1);
    printf("Text 3D: %d\n", _:c);
    d = CreateMenu("Title", 1, 1.0, 1.0, 1.0, 1.0);
    printf("Menu: %d\n", _:d);
    return 1;
}
Now look at the results. What caused devs to switch from 0 to 1 as base ID? The INVALID_* constants are identical (0xFFFF, and 0xFF for menus). Was it forced to allow one more item? If yes - can't we do it with older functions too? Or it would cause to big BC break?


Re: ID's assignment - leonardo1434 - 03.09.2012

https://sampwiki.blast.hk/wiki/Starting_IDs


Re: ID's assignment - Misiur - 03.09.2012

I'm not asking which are, and which aren't - but why


Re: ID's assignment - leonardo1434 - 03.09.2012

i have no idea why it's like this... i guess you will have to wait for a beta tester.


Re: ID's assignment - Slice - 03.09.2012

I don't think there's any thought behind this, and that it just happened to be that way.


Re: ID's assignment - Misiur - 03.09.2012

Ok - now what would happen if in next major release there was a change from 1 to 0 (except from silly people hardcoding vehicle id's in their scripts)? Are there some complicated internal consequences?


Re: ID's assignment - Slice - 03.09.2012

I doubt they would do that. Mainly because GetPlayerVehicleID returns 0 when the player isn't in a vehicle (IIRC), which would break many scripts.


Re: ID's assignment - [ABK]Antonio - 03.09.2012

Quote:
Originally Posted by Slice
View Post
I doubt they would do that. Mainly because GetPlayerVehicleID returns 0 when the player isn't in a vehicle (IIRC), which would break many scripts.
Yeah, it returns 0 (false) if the player isn't in a vehicle