Quote:
Originally Posted by DaniceMcHarley
pawn Code:
public OnPlayerSpawn(playerid) { if(pInfo[playerid][Newbie] == 1) { //new str[128]; Why 128? you only need 20-30 max. new str[30],vw = GetPlayerVirtualWorld(playerid); SetPlayerVirtualWorld(playerid, vw + random(999)); format(str, sizeof(str), "You are in VW %d.",vw); // Don't call the function GetPlayerVirtualWorld twice, you could call it once and assign it to a variable. SendClientMessage(playerid, -1, str); } return 1; }
|
He didn't call he function twice, and you're at one point giving him advice to save processing, but on the other hand you're advicing him to add more processing (random). It doesn't have to be that hard.
Even my code were less efficient than
Sjn's since I still had an integer, and his used 'playerid' which is already defined.
The only code he needs is playerid+whateverhewants and nobody else will get the same VW.