SA-MP Forums Archive
2 warning's - 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: 2 warning's (/showthread.php?tid=109204)



2 warning's - Mechscape - 18.11.2009

Compile error:
Код:
C:\Documents and Settings\Administraator\Desktop\San Andreas Multiplayer server\gamemodes\*******.pwn(18841) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Administraator\Desktop\San Andreas Multiplayer server\gamemodes\*******.pwn(18841) : warning 202: number of arguments does not match definition
In-Line error:
Код:
GetPlayerName(giveplayerid, pName, sizeof(pName));
Full-half code:
Код:
if(giveplayerid != INVALID_PLAYER_ID)
				  {
				    new pName[MAX_PLAYER_NAME];
  						GetPlayerName(giveplayerid, pName, sizeof(pName));
				    SendClientMessage(playerid, COLOR_GRAD1, "=== ADMINCHECK - PlayerID: %d / Player: %s ===", giveplayerid, pName);
						ShowStats(playerid,giveplayerid);
					}



Re: 2 warning's - Correlli - 18.11.2009

You need to format the message before you use it in the SendClientMessage function.


Re: 2 warning's - Mechscape - 18.11.2009

Half-full code:
Код:
if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
				    new pName[MAX_PLAYER_NAME];
				    new string[256];
  						GetPlayerName(giveplayerid, pName, sizeof(pName));
  						format(string, 256, "=== ADMINCHECK - PlayerID: %d / Player: %s ===", giveplayerid, pName);
						SendClientMessage(playerid, COLOR_RED, string);
						ShowStats(playerid,giveplayerid);
					}
				}
Error:
Код:
C:\Documents and Settings\Administraator\Desktop\San Andreas Multiplayer server\gamemodes\******.pwn(18840) : warning 219: local variable "string" shadows a variable at a preceding level
In-Line error:
Код:
new string[256];



Re: 2 warning's - Correlli - 18.11.2009

It's not error, it's warning. The local variable has the same name as the global - rename one of them.


Re: 2 warning's - Mechscape - 18.11.2009

Quote:

/call 911
Hello!
Close topic, thanks.
/hangup




Re: 2 warning's - Peter_Corneile - 18.11.2009

pawn Код:
if(IsPlayerConnected(giveplayerid))
                {
                  if(giveplayerid != INVALID_PLAYER_ID)
                  {
                    new pName[MAX_PLAYER_NAME];
                        GetPlayerName(giveplayerid, pName, sizeof(pName));
                        format(string, 256, "=== ADMINCHECK - PlayerID: %d / Player: %s ===", giveplayerid, pName);
                        SendClientMessage(playerid, COLOR_RED, string);
                        ShowStats(playerid,giveplayerid);
                    }
                }