Which is faster?
#1

is this faster
Код:
if (sscanf(params, "ud",id,amount)) return SendClientMessage(playerid,-1,"msg");
or
Код:
if (sscanf(params, "ud",id,amount))
{
SendClientMessage(playerid,-1,"msg")
return 0;
}
Reply
#2

both are same for me if I am not wrong. But if they have any difference then it will be 1 to 2 ms.
Reply
#3

Theoretically they're two different things because the first one returns the value returned by SendClientMessage (which is usually 1) while the other one just returns 0.

For readability reasons, however, I prefer to always put a return statement on a line of its own. I don't even begin to read code that's all crammed together with zero whitespace (= spaces, tab, or newlines).
Reply
#4

I prefer using this:
PHP код:
extract params -> new player:idamount; else return SendClientMessage(playerid, -1"Lol invalid params you naaaaap"); 
Anyways, no need to open brackets or shits for a simple thing, just one line is enough.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)