String help - 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)
+--- Thread: String help (
/showthread.php?tid=387738)
String help -
Jassey - 26.10.2012
I got the problem like this:
Код:
J:\Game\Server File\Stregs\gamemodes\SRC.pwn(77015) : warning 219: local variable "string" shadows a variable at a preceding level
J:\Game\Server File\Stregs\gamemodes\SRC.pwn(77039) : warning 219: local variable "string" shadows a variable at a preceding level
J:\Game\Server File\Stregs\gamemodes\SRC.pwn(77064) : warning 219: local variable "string" shadows a variable at a preceding level
J:\Game\Server File\Stregs\gamemodes\SRC.pwn(77089) : warning 219: local variable "string" shadows a variable at a preceding level
J:\Game\Server File\Stregs\gamemodes\SRC.pwn(77114) : warning 219: local variable "string" shadows a variable at a preceding level
J:\Game\Server File\Stregs\gamemodes\SRC.pwn(77140) : warning 219: local variable "string" shadows a variable at a preceding level
J:\Game\Server File\Stregs\gamemodes\SRC.pwn(86973) : warning 219: local variable "string" shadows a variable at a preceding level
J:\Game\Server File\Stregs\gamemodes\SRC.pwn(93578) : warning 203: symbol is never used: "Boombox"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
8 Warnings.
How can i fix this?
The line 86973
Код:
if(dialogid == TUTORIALMENU)
{
if(response)
{
HideTutGUIBox(playerid);
HideTutGUIFrame(playerid, 23);
TutStep[playerid] = 0;
PlayerInfo[playerid][pTut] = 1;
gOoc[playerid] = 0; gNews[playerid] = 0; gFam[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetCamBack(playerid);
DeletePVar(playerid, "MedicBill");
SetPlayerColor(playerid,TEAM_HIT_COLOR);
SetPlayerInterior(playerid,1); // asalnya 0
SetPlayerPos(playerid, 3.00,26.30,1199.59);
SetPlayerFacingAngle(playerid, 359.4621);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid, 0);
new string[128];
DeletePVar(playerid, "IsFrozen");
TogglePlayerControllable(playerid, 1);
format(string, sizeof(string), "%s melewati tahap tutorial.",GetPlayerNameEx(playerid),GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);
}
else
{
RegistrationStep[playerid] = 0;
SetPlayerVirtualWorld(playerid, 0);
ClearChatbox(playerid);
ShowTutGUIBox(playerid);
ShowTutGUIFrame(playerid, 1);
TutStep[playerid] = 1;
}
return 1;
}
Re : String help -
lelemaster - 26.10.2012
new string is already defined as a global variable. Find it and remove it.
Re: String help -
Lordzy - 26.10.2012
Well I see that you've formatted the string incorrectly and that might be the reason of the warnings.
Try replacing your line:
pawn Код:
format(string, sizeof(string), "%s melewati tahap tutorial.",GetPlayerNameEx(playerid),GetPlayerNameEx(playerid)); //Here why 2 getplayernameex?
To:
pawn Код:
format(string, sizeof(string), "%s melewati tahap tutorial.",GetPlayerNameEx(playerid));
Or to:
pawn Код:
new Lname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Lname,sizeof(Lname));
format(string, sizeof(string), "%s melewati tahap tutorial.", Lname);