05.08.2012, 15:02
Today I learned that while(cond) and for(; cond; ) are running with exactly the same speed, and thus probably compile to the same amx instructions. (would be strange if they wouldnt)
new RandomVar[][128]
{
"Some string",
"Some string",
"Some string",
"Some string"
};
new RandomVar[4][128]
{
"Some string",
"Some string",
"Some string",
"Some string"
};
new forcedparam[24],optionalparam[24];
if(sscanf(params, "s[24],S[24]()",forcedparam, optionalparam))
new bool: IsAMoron [ MAX_PLAYERS ],
OtherVariable;
new
OtherVariable,
bool: IsAMoron [ MAX_PLAYERS ] = false;
new LawlVar [ MAX_PLAYERS ] ;
LawlVar [ playerid ] = 1 ;
if ( LawlVar [ playerid ] == 1 )
{
...
}
foreach ( new i : Player )
{
...
}
new aaaaaaaaaaaaaaaaaaaaaaaaa;
new a;
stock Teleport(playerid, Float:x, Float:y, Float:z, Int = -1, VW = -1)
{
some code...
}
Teleport(playerid, 1.0, 2.0, 3.0, -1, 5);
Teleport(playerid, 1.0, 2.0, 3.0, .VW = 5);
stock IsSQLiteDatabaseExists(dbname[])
{
format(query,sizeof(query),"SELECT * FROM `%s` LIMIT 1",dbname);
if(!db_query(DB: database, query)) return 0; else return 1;
}
if(!IsSQLiteDatabaseExists("SAMP"))
{
printf("[SQLite] SAMP Table does not exists , Creating one... Created Successfully!");
}
//Note: You must have opened have declared the dbname as "database" or you change the dbname used in the above function which is opened by the script and operations are done on it.
stock const STR[] = "hi";
main()
{
if (strcmp(STR, OTHER_STRING, false, sizeof (STR) - 1) {}
}
main()
{
if (strcmp("hi", OTHER_STRING, false, 2) {}
}
main()
{
if (strcmp("hi", OTHER_STRING, false, strlen("hi")) {}
}
0b_10_1 0x_1DEAD 1_3_4_5 1_2.1_e-4
digit: [0-9] hex: [a-fA-f0-9] boolean: 0b[01_]+ integer: {digit}({digit}|_)* hexadec: ({digit}|(0x)?)({hex} | '_')* float: {digit}({digit} | '_')*\.{digit}({digit} | '_')*(e(-)?{digit}*)?
if ('0' <= string[0] <= '9')
CMD:kill(playerid,params[])
{
SetPlayerHealth(playerid,0.0);
SendClientMessage(playerid, 0xFFFF0000, "Stupid, why did you commit suicide!?");
new name[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid, name, sizeof(name));
format (string, sizeof(string), "%s has suicided.", name);
SendClientMessageToAll(0xFB0000AA, string);
return 1;
}
CMD:cmds(playerid,params[])
{
new string[1024];
new longstring[1024];
format(string, sizeof(string),"/kill - Suicide\n/car - Spawns a car\n/tcar - Spawns a pre-tuned car\n/fix - Fix a car\n/nos - Add nitrous on your car\n");
strcat(longstring,string,sizeof(longstring));
format(string, sizeof(string),"/xnos - Remove nitrous from your car\n/godcar - Make the car god\n/teles - Teleports\n/updates - Check the current update\n/website - Our forum!\n");
strcat(longstring,string,sizeof(longstring));
format(string, sizeof(string),"/gps - Find the player\n/setmytime - Set your time\n/radio - Play radio\n/music - Play music\n/stop - Stop everything that you're playing\n");
strcat(longstring,string,sizeof(longstring));
format(string, sizeof(string),"/pc - Parachute\n/respawn - Respawn\n/antifall - Toggle Antifall\n/autofix - Toggle Autofix\n/god - Toggle GodMode");
strcat(longstring,string,sizeof(longstring));
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Commands", longstring, "OK", "");
return 1;
}