13.07.2012, 07:54
Your else-if statement is getting called ~ 200 (depends on the vehicle ID) times when the function is getting used. Is that efficient? No.
The switch statement get called once and checks the value of the given variable in a loop, until it reaches the correct variable.
Format is meant for strings with a dynamic variable in the string. E.g your name
If you just give the string a different value (I am not sure if I am saying it right in English) without a dynamic variable in the string, you will simply just give it a different value:
I'm trying to explain it as simple as possible.
The switch statement get called once and checks the value of the given variable in a loop, until it reaches the correct variable.
Format is meant for strings with a dynamic variable in the string. E.g your name
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof name);
format(string, 128,sizeof string, "%s", name)
pawn Код:
new name[50];
name = "Welcome milanosie!";
SendClientMessage(playerid, 0x000000FF, name);