07.07.2011, 02:17
(
Последний раз редактировалось SmileyForCheat; 02.11.2014 в 03:33.
)
Penis
|
loose indentation |
|
local variable blablabla |
|
symbol is never used:blablabla |
|
number of arguments does not match definition |
|
What an immature people.
Btw I better give you the explanation of it. Tabulation thing. You make a new variable that's already exist. You never use the variable you made. It says all. |
loose indentation
//bad indentation
OnPlayerConnect(playerid)
{
//dosomething
//dosomething
//dosomething
}
//good indentation
OnPlayerConnect(playerid)
{
//dosomething
//dosomething
//dosomething
}
local variables shadows another variable
new string[128]; // this variable is already there
OnPlayerConnect(playerid)
{
new string[128]; // this shouldn't be here
format(string, sizeof(string), "Welcome to the server %s", PlayerName(playerid));
SendClientMessage(playerid, COLOR_GREEN, string);
}
symbol is never used
new string[128]; // I don't see this being used anywhere
OnPlayerConnect(playerid)
{
return 1;
}
symbol is assigned to a value that is never used
new vehicleid = GetPlayerVehicleID(playerid); // i don't see this being used
OnPlayerConnect(playerid)
{
return 1;
}
number of arguments does not match definition
OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, x, y, z, a/*this isn't supposed to be there*/);
return 1;
}
OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, x, y, z); // now that's better
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
//Opening curl bracket, so we indent four spaces (hit the tab key).
if(!strcmp(cmdtext, "//example")) // strcmp just for the example
{
//Another opening curl bracket, so we indent four more spaces.
//Some code...
}
//We're done with the if statement, and add a closing curly bracket, so we go back four spaces.
return 0;
}
//Done with the callback, so we're back were we started (and we repeat :P).
new g_Example = 0; // This is outside of any function or callback, so its global...can be used anywhere in this example
public OnPlayerCommandText(playerid, cmdtext[])
{
new Example = 0; //Normally if our previous var didnt have the preceeding "g_" this would've given a warning.
if(!strcmp(cmdtext, "//example"))
{
new Example = 0 // This still will give a warning, as there's a var above it (in the same local scope) with the same name ... either use the previous one, or rename this one.
}
//The Example var (the warning one inside the if statement) is out of scope now.
return 0;
}
//The first Example var (one before the if statement) is no out of scope
//g_Example is global so its been in scope the entire time, and still is.
new stock g_MyVar = 0;