A Rare Error - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: A Rare Error (
/showthread.php?tid=209138)
A Rare Error -
[TDL]OGLoc - 09.01.2011
Code:
if(!strcmp(cmd, "/giverpp", true))
that think trowh this error:
Code:
warning 217: loose indentation
Why?
Re: A Rare Error -
blackwave - 09.01.2011
Really have to do with that? nothing's wrong there. Also the code is correct, and should work. Post the line. Before and after one.
Re: A Rare Error -
Souvlaki - 09.01.2011
Because strcmp is way too old to be used.
We need to see the whole structure of the command(i guess) to tell you, plus it's not an error but a warning.
Re: A Rare Error -
ToPhrESH - 09.01.2011
Some where you are missing an identation. Press tab to indent it to see if it fixes this.
Re: A Rare Error -
[TDL]OGLoc - 09.01.2011
Code:
//============================================[ ROLEPLAY POINT] ====================================================
if(strcmp(cmd, "/giverpp", true) == 0)//mueve esto hacia adelante que quede al raz
{//de este
if(PlayerInfo[playerid][Level] >= 3)
{
new tmp[256], player1;//el 'tmp2' no hacia funcion y el 'tmp' no estaba definido
tmp = strtok(cmdtext,idx);//aqui no tenia el ';'
if(!strlen(tmp)) return SendClientMessage(playerid, yellow, "USAGE: /giverpp [playerid]");
player1 = strval(tmp);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
CMDMessageToAdmins(playerid,"GIVERPP");
SaveToFile("Rpp",string);
PlayerInfo[player1][Rpp]++;
format(string, sizeof(string), "You have given a Roleplay Point To \"%s\"", PlayerName2(player1));//aqui faltaba un ')'
SendClientMessage(playerid,yellow,string);
if(player1 != playerid)
{
format(string,sizeof(string),"Administrator \"%s\" has given you a Roleplay Point", PlayerName2(playerid));//aqui tambien un ')'
SendClientMessage(player1,yellow,string);
SendClientMessageToAll(yellow,"Administrator \"%s\" has given %s a Roleplay Point", PlayerName2(playerid), playerid);
PlayerInfo[playerid][Rpp]++;
}
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
return 1;
}
That is what i have
Re: A Rare Error -
Kyosaur - 09.01.2011
Quote:
Originally Posted by Souvlaki
Because strcmp is way too old to be used.
We need to see the whole structure of the command(i guess) to tell you, plus it's not an error but a warning.
|
Strcmp is to old to be used!?! Hahahahahaha, not at all.
This warning is saying that something isnt indented correctly.
http://dracoblue.net/tidy/pawn/
This will re-indent your code, put the entire command inside and "convert" it.
Re: A Rare Error -
John_F - 09.01.2011
what he means is, strcmp is by far the worst option.
Re: A Rare Error -
Krx17 - 10.01.2011
No it's not. Where do people come up with these assumptions? Do you even know what strcmp stands for?
String compare. If your comparing it to functions like sscanf, then you are an idiot. sscanf and strcmp serve two different purposes. strcmp will compare two strings to each other with or without case sensitivity and return whether they are the same or not. sscanf will compare a string with format codes and parse out values if the string matches the format codes.
Re: A Rare Error -
[TDL]OGLoc - 10.01.2011
I can repair it but what about this one
Code:
new tmp[256], player1;
i get this warning
Code:
pwn(4454) : warning 219: local variable "tmp" shadows a variable at a preceding level
Re: A Rare Error -
John_F - 10.01.2011
Quote:
Originally Posted by Krx17
No it's not. Where do people come up with these assumptions? Do you even know what strcmp stands for? String compare. If your comparing it to functions like sscanf, then you are an idiot. sscanf and strcmp serve two different purposes. strcmp will compare two strings to each other with or without case sensitivity and return whether they are the same or not. sscanf will compare a string with format codes and parse out values if the string matches the format codes.
|
I never said to use sscanf in lieu of strcmp.
He's using it for commands, where strcmp is comparatively slow (compared to processors like zcmd and dcmd).
How about you read the thread before posting a useless reply?