PDA

View Full Version : 2 warnings


KamalBa
07/07/2015, 06:56 AM
How to solve it's the first time It's show this Message. I know ZCMD is easy but, I got the script from someone and it's an old script

I made 2 commands and got 2 warnings one with /afk and other with /back


C:\Users\win7\Desktop\Roleplay Script\gamemodes\bb_freeroam.pwn(11475) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\win7\Desktop\Roleplay Script\gamemodes\bb_freeroam.pwn(11484) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.


NOW THE COMMANDS

/afk COMMAND

Line : 11473 if (strcmp(string, "/afk", true) == 0)
Line : 11474 {
Line : 11475 new name[MAX_PLAYER_NAME], string[128];
Line : 11476 GetPlayerName(playerid, name, MAX_PLAYER_NAME);
Line : 11477 format(string, sizeof(string), "%s is now AFK", name);
Line : 11478 SendClientMessageToAll(COLOR_YELLOW, string);
Line : 11479 TogglePlayerControllable(playerid, 0);
Line : 11480 return 1;
Line : 11481 }



/back COMMAND

Line : 11482 if (strcmp(string, "/back", true) == 0)
Line : 11483 {
Line : 11484 new name[MAX_PLAYER_NAME], string[128];
Line : 11485 GetPlayerName(playerid, name, MAX_PLAYER_NAME);
Line : 11486 format(string, sizeof(string), "%s Back", name);
Line : 11487 SendClientMessageToAll(COLOR_YELLOW, string);
Line : 11488 TogglePlayerControllable(playerid, 1);
Line : 11489 return 1;
Line : 11490 }

X337
07/07/2015, 07:00 AM
/AFK

Line : 11473 if (strcmp(string, "/afk", true) == 0)
Line : 11474 {
Line : 11475 new name[MAX_PLAYER_NAME], stringz[128];
Line : 11476 GetPlayerName(playerid, name, MAX_PLAYER_NAME);
Line : 11477 format(stringz, sizeof(stringz), "%s is now AFK", name);
Line : 11478 SendClientMessageToAll(COLOR_YELLOW, stringz);
Line : 11479 TogglePlayerControllable(playerid, 0);
Line : 11480 return 1;
Line : 11481 }


/back

Line : 11482 if (strcmp(string, "/back", true) == 0)
Line : 11483 {
Line : 11484 new name[MAX_PLAYER_NAME], stringz[128];
Line : 11485 GetPlayerName(playerid, name, MAX_PLAYER_NAME);
Line : 11486 format(stringz, sizeof(stringz), "%s Back", name);
Line : 11487 SendClientMessageToAll(COLOR_YELLOW, stringz);
Line : 11488 TogglePlayerControllable(playerid, 1);
Line : 11489 return 1;
Line : 11490 }

KamalBa
07/07/2015, 07:06 AM
Ty solved, anyone have an idea how to upload my script to ZCMD command, cause maybe a lot of commands will get error so..

youssefehab500
07/07/2015, 08:14 AM
Just check a tutorial on how to convert from strcmp to ZCMD. It is really easy.