#1

Code:
C:\Users\PC01\Desktop\lsgw\filterscripts\AS.pwn(1261) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\PC01\Desktop\lsgw\filterscripts\AS.pwn(1285) : warning 219: local variable "str" shadows a variable at a preceding level
first code
Code:
CMD:kick(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
	{
        new PID; //define the playerid we wanna kick
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
        GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, -1, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, -1, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
        SendClientMessageToAll(-1, str); //send that message to all
        Kick(PID); //kick the playerid we've defined
    }
    else //if he has not got the permissions
    {
        SendClientMessage(playerid, -1, "You have to be level 2 to use that command!"); //return this message
    }
    return 1;
}

second code
Code:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
	{
        new PID; //define the playerid we wanna ban
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
        GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, -1, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, -1, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
        SendClientMessageToAll(-1, str); //send that message to all
        Ban(PID); //Ban the playerid we've defined
    }
    else //if he has not got the permissions
    {
        SendClientMessage(playerid, -1, "You have to be level 5 to use that command!"); //return this message
    }
    return 1;
}
Reply
#2

You defined the variable str twice, you will have to rename it or just make it a global variable and use it so that you don't have to keep on redefining it. Search your script for "new str" and remove the global variable or just remove those redefines in your code/command and use the global variable instead.
Reply
#3

Fixed, but now i'm worried about this

Code:
C:\Users\PC01\Documents\nametag.pwn(97) : error 017: undefined symbol "foreach"
C:\Users\PC01\Documents\nametag.pwn(97) : error 029: invalid expression, assumed zero
C:\Users\PC01\Documents\nametag.pwn(97) : error 017: undefined symbol "i"
C:\Users\PC01\Documents\nametag.pwn(97) : fatal error 107: too many error messages on one line
Code:
forward UpdateNametag();
public UpdateNametag()
{
	foreach(new i : Player)
	{
        if(IsPlayerConnected(i))
        {
            new nametag[128], playername[MAX_PLAYER_NAME], Float:armour;
            GetPlayerArmour(i, armour);
            GetPlayerName(i, playername, sizeof(playername));
			if(armour > 1.0)
			{
				format(nametag, sizeof(nametag), "{%06x}%s {FFFFFF}(%i)\n{FFFFFF}%s\n{FF0000}%s", GetPlayerColor(i) >>> 8, playername, i, GetArmorDots(i), GetHealthDots(i));
			}
			else
			{
				format(nametag, sizeof(nametag), "{%06x}%s {FFFFFF}(%i)\n{FF0000}%s", GetPlayerColor(i) >>> 8, playername, i, GetHealthDots(i));
			}
			UpdateDynamic3DTextLabelText(cNametag[i], 0xFFFFFFFF, nametag);
		}
	}
}
Reply
#4

Update your foreach to the latest version.
Reply
#5

Quote:
Originally Posted by TheToretto
View Post
Update your foreach to the latest version.
I did and still not working
Code:
C:\Users\PC01\Desktop\lsgw\filterscripts\nametag.pwn(97) : error 017: undefined symbol "foreach"
C:\Users\PC01\Desktop\lsgw\filterscripts\nametag.pwn(97) : error 029: invalid expression, assumed zero
C:\Users\PC01\Desktop\lsgw\filterscripts\nametag.pwn(97) : error 017: undefined symbol "i"
C:\Users\PC01\Desktop\lsgw\filterscripts\nametag.pwn(97) : fatal error 107: too many error messages on one line
Reply
#6

it not working because you update but it not the latest version
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)