PDA

View Full Version : [HELP] Loose Indentation and Other Stuffs


NewbieTester
15/08/2014, 09:09 AM
C:\Program Files\Windows Version [0.3z]\gamemodes\gangwar.pwn(301) : warning 217: loose indentation
C:\Program Files\Windows Version [0.3z]\gamemodes\gangwar.pwn(304) : warning 217: loose indentation
C:\Program Files\Windows Version [0.3z]\gamemodes\gangwar.pwn(304) : error 029: invalid expression, assumed zero
C:\Program Files\Windows Version [0.3z]\gamemodes\gangwar.pwn(304) : error 004: function "S@@_OnPlayerDisconnect" is not implemented
C:\Program Files\Windows Version [0.3z]\gamemodes\gangwar.pwn(315) : error 030: compound statement not closed at the end of file (started at line 194)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.


Heres' The Code from Line 301 to 314

return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}



What's Wrong With this Code ?

NewbieTester
15/08/2014, 09:17 AM
Bump

NewbieTester
15/08/2014, 09:52 AM
bump

SHE790
15/08/2014, 10:34 AM
show line 250 to 301

NewbieTester
15/08/2014, 10:41 AM
SendClientMessage(playerid, -1, "Sniper purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
}
switch(dialogid)
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);

SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}

SHE790
15/08/2014, 10:49 AM
This for Loose Indentation
switch(dialogid)
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);

SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}

NewbieTester
15/08/2014, 10:51 AM
No , the Problem Is Here

public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}

Faisal_khan
15/08/2014, 11:09 AM
You messed up with braces here: switch(dialogid)
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);

SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}

NewbieTester
15/08/2014, 11:14 AM
No , The Errors are in Line 304 ,
And here is my Line 304

public OnPlayerDisconnect(playerid, reason)

Faisal_khan
15/08/2014, 11:17 AM
warning 217: loose indentation means that your code is not properly indented. ****** it. And try my code replace them with yours. Just do what I said.
error 030: compound statement not closed at the end of file (started at line 194) this means you forgot a brace. Post line 190 to 315.

NewbieTester
15/08/2014, 11:26 AM
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == SHOP_DIALOG)//If the dialog responded to is our Weapon Shop dialog.
{
if(!response) return SendClientMessage(playerid, -1, "You have left the Weapon Shop.");//If they click "Exit" they have left the dialog(Shop).
switch(listitem)
{
case 0://Deagle
{
if(GetPlayerMoney(playerid) >= 1500)
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 500);
GivePlayerWeapon(playerid, 24, 100);
SendClientMessage(playerid, -1, "Deagle purchased.");
return 1;
}
else
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;
}
}
case 1:
{
if(GetPlayerMoney(playerid) >= 5000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 1000);
GivePlayerWeapon(playerid, 26, 100);
SendClientMessage(playerid, -1, "Sawn-Off purchased.");
return 1;
}
else
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;
}
}
case 2:
{
if(GetPlayerMoney(playerid) >= 2000)
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 2000);//Take the cost.
GivePlayerWeapon(playerid, 31, 100);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "M4 purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 3://Sniper
{
if(GetPlayerMoney(playerid) >= 3000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 3000);//Take the cost.
GivePlayerWeapon(playerid, 34, 100);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "Sniper purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
}
switch(dialogid)
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);

SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return false;
}
}
}
return 1;
}

There

Faisal_khan
15/08/2014, 11:32 AM
Here:public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == SHOP_DIALOG)//If the dialog responded to is our Weapon Shop dialog.
{
if(!response) return SendClientMessage(playerid, -1, "You have left the Weapon Shop.");//If they click "Exit" they have left the dialog(Shop).
switch(listitem)
{
case 0://Deagle
{
if(GetPlayerMoney(playerid) >= 1500)
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 500);
GivePlayerWeapon(playerid, 24, 100);
SendClientMessage(playerid, -1, "Deagle purchased.");
return 1;
}
else
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;
}
}
case 1:
{
if(GetPlayerMoney(playerid) >= 5000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 1000);
GivePlayerWeapon(playerid, 26, 100);
SendClientMessage(playerid, -1, "Sawn-Off purchased.");
return 1;
}
else
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;
}
}
case 2:
{
if(GetPlayerMoney(playerid) >= 2000)
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 2000);//Take the cost.
GivePlayerWeapon(playerid, 31, 100);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "M4 purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 3://Sniper
{
if(GetPlayerMoney(playerid) >= 3000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 3000);//Take the cost.
GivePlayerWeapon(playerid, 34, 100);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "Sniper purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, -1, "You dont have the enough money to purchase this weapon.");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
}
}
switch(dialogid)
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);

SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return false;
}
}
}
return 1;
}

NewbieTester
15/08/2014, 11:34 AM
It Worked , +Rep Faisal ^.^