ID's assignment
#1

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

https://sampwiki.blast.hk/wiki/Starting_IDs
Reply
#3

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

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

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

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)