2 warnings - 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: 2 warnings (
/showthread.php?tid=580660)
2 warnings -
KamalBa - 07.07.2015
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 © 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 }
Re: 2 warnings -
X337 - 07.07.2015
/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 }
Re: 2 warnings -
KamalBa - 07.07.2015
Ty solved, anyone have an idea how to upload my script to ZCMD command, cause maybe a lot of commands will get error so..
Re: 2 warnings -
youssefehab500 - 07.07.2015
Just check a tutorial on how to convert from strcmp to ZCMD. It is really easy.