Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: kitt85711 on March 10, 2012, 07:07:51 am

Title: Skins
Post by: kitt85711 on March 10, 2012, 07:07:51 am
Can I get help on how I would fix my skin cmd? When your at a certain place and you are aloud that function for instance, I'm a cop I want to be like a UC cop, I have to go to the station to become that but I get a warning in my command. Can someone tell me how to fix this? I already have "cop," at the enum pInfo so I got that defined.

}
   else if (strcmp(cmd, "!cop", true) == 0) {
      if (PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_GREEN, "Please login first");
      else {
         new szMsg[256];
         SetPlayerSkin(playerid, 1);
         SetPlayerWeapon(playerid, 17, 500);
         SetPlayerWeapon(playerid, 19, 500);
         PlayerInfo[playerid][cop] = 1;
         format(szMsg, sizeof(szMsg), "Welcome to the force, officer %s", gPlayers[playerid]);
         SendClientMessage(playerid, COLOR_GREEN, szMsg);
         SendClientMessage(playerid, COLOR_GREEN, "!cophelp");
         SetSpikes(playerid,1);
      }
      return 1;

And the warning I get says: warning 219: local variable "szMsg" shadows a variable at a preceding level

How would I fix this so I can remove the 5 warnings I have?
Title: Re: Skins
Post by: stormeus on March 10, 2012, 10:28:30 am
If it "shadows a variable at a preceding level," you already have szMsg defined outside of that else if. Get rid of new szMsg[256]; in that command and it shouldn't throw a warning. If I recall, it should work correctly regardless.
Title: Re: Skins
Post by: YoMan on March 10, 2012, 01:33:11 pm
Warning Compile the Script But the Error Cant Compile