[HELP]How to Fix It ?? +REP
#1

I want to Add GameTextForAll in This Code
when i Add it i have 4 Errors ...

This is the Code :
Код:
CMD:armourall(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4) {
		CMDMessageToAdmins(playerid,"ARMOURALL");
	   	for(new i = 0; i < MAX_PLAYERS; i++) {
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
				PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerArmour(i,100.0);
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has restored all players armour", pName(playerid) );
  		new name[24], string2[64];
    	GetPlayerName(playerid, pName, 24);
    	// Format the passed-away message properly, and show it to everyone:
    	format( string2, sizeof(string2), "~w~Administrator ~b~ %s ~w~has Restored All Players ~r~Armour", pName);
    	GameTextForAll(string2, 5000, 3 );
		return SendClientMessageToAll(blue, string2);
	} else return SendClientMessage(playerid,red,"ERROR: You need to be level 4 to use this command");
}
ERRORS:
Quote:

G:\GTA SA-MP Installers\DwTDM~RP v17\gamemodes\DwTDM_v21.pwn(20751) : warning 219: local variable "name" shadows a variable at a preceding level
G:\GTA SA-MP Installers\DwTDM~RP v17\gamemodes\DwTDM_v21.pwn(20752) : error 076: syntax error in the expression, or invalid function call
G:\GTA SA-MP Installers\DwTDM~RP v17\gamemodes\DwTDM_v21.pwn(20754) : error 076: syntax error in the expression, or invalid function call
G:\GTA SA-MP Installers\DwTDM~RP v17\gamemodes\DwTDM_v21.pwn(20751) : warning 204: symbol is assigned a value that is never used: "name"
G:\GTA SA-MP Installers\DwTDM~RP v17\gamemodes\DwTDM_v21.pwn(20770) : warning 219: local variable "name" shadows a variable at a preceding level
G:\GTA SA-MP Installers\DwTDM~RP v17\gamemodes\DwTDM_v21.pwn(20771) : error 076: syntax error in the expression, or invalid function call
G:\GTA SA-MP Installers\DwTDM~RP v17\gamemodes\DwTDM_v21.pwn(20773) : error 076: syntax error in the expression, or invalid function call
G:\GTA SA-MP Installers\DwTDM~RP v17\gamemodes\DwTDM_v21.pwn(20770) : warning 204: symbol is assigned a value that is never used: "name"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

How to Fix It ???

+1REP for Who Can Fix It !!!
Reply
#2

try
Код:
if(strcmp(cmd, "/armourall", true) == 0)	 {
    if(PlayerInfo[playerid][Level] >= 3) {
    	CMDMessageToAdmins(playerid,"ARMOURALL");   GetPlayerName(playerid, adminname, sizeof(adminname));
    	SendClientMessage(playerid,blue,"You have given all players armour");
	   	for(new i = 0; i <= MAX_PLAYERS; i++)
		{
		if(IsPlayerConnected(i) == 1)	{
		SetPlayerArmour(i,100.0); PlayerPlaySound(i,1057,0.0,0.0,0.0);	format(string,256,"Administrator %s has restored your armour",adminname);	SendClientMessage(i,blue,string);	}
		}
	} else 	{
	SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");	}
 	return 1;	}
Reply
#3

Give a try

Код HTML:
	new messtring[128], pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	format(messtring, sizeof(messtring), "~w~Administrator ~b~ %s(%d) ~w~has Restored All Players ~r~Armour",pName, playerid);
	GameTextForAll(messtring, 5000, 3 );
Maybe a global variable somewhere in your gm/fs
Quote:

warning 219: local variable "name" shadows a variable at a preceding level

Reply
#4

Quote:
Originally Posted by gotwarzone
Посмотреть сообщение
Give a try

Код HTML:
	new messtring[128], pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	format(messtring, sizeof(messtring), "~w~Administrator ~b~ %s(%d) ~w~has Restored All Players ~r~Armour",pName, playerid);
	GameTextForAll(messtring, 5000, 3 );
Maybe a global variable somewhere in your gm/fs
The GameText isn't show In the Game
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)