warning 219: local variable "giveplayerid" shadows a variable at a preceding level
#1

help how to fix?
Код:
warning 219: local variable "giveplayerid" shadows a variable at a preceding level
Код:
if(strcmp(cmd, "/bemutatkoz",true) == 0)
    {
		new giveplayerid; <<<WARNING!
	//	if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
		if(playerid == giveplayerid) return SendClientMessage(playerid, 0x33AA33AA, "(( Magadnak nem mutatkozhatsz be! ))");
		new USER_FILE[64];
		format(USER_FILE, sizeof(USER_FILE), "SFSUsers/%s.ini", GetPlayerNameEx(playerid));
		if(DOF2_GetInt(USER_FILE, GetPlayerNameEx(giveplayerid)) == 1) return SendClientMessage(playerid, 0x33AA33AA, "(( Mбr ismeritek egymбst! ))");
		new iStr[70];
		format(iStr, sizeof(iStr), "(( Bemutatkozбs kйrelmet elkьldted neki: %s ))", GetPlayerNameEx(giveplayerid));
		SendClientMessage(playerid, 0x33AA33AA, iStr);
		format(iStr, sizeof(iStr), "Ьdv! %s vagyok йs a barбtod szeretnйk lenni.\nElfogadod?", GetPlayerNameEx(playerid));
		ShowPlayerDialog(giveplayerid, AMIGODIALOG, DIALOG_STYLE_MSGBOX, "Цn elfogadja?", iStr, "Igen", "Nem");
		SetPVarInt(giveplayerid, "AmigoRequest", playerid);
		return 1;
	}
Reply
#2

You have giveplayerid as a global (in top of your script), pick another thing like:

pawn Код:
if(strcmp(cmd, "/bemutatkoz",true) == 0)
    {
        new guyid; <<<WARNING!
    //  if(sscanf(params, "u", guyid)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
        if(playerid == guyid) return SendClientMessage(playerid, 0x33AA33AA, "(( Magadnak nem mutatkozhatsz be! ))");
        new USER_FILE[64];
        format(USER_FILE, sizeof(USER_FILE), "SFSUsers/%s.ini", GetPlayerNameEx(playerid));
        if(DOF2_GetInt(USER_FILE, GetPlayerNameEx(guyid)) == 1) return SendClientMessage(playerid, 0x33AA33AA, "(( M?r ismeritek egym?st! ))");
        new iStr[70];
        format(iStr, sizeof(iStr), "(( Bemutatkoz?s kйrelmet elkьldted neki: %s ))", GetPlayerNameEx(guyid));
        SendClientMessage(playerid, 0x33AA33AA, iStr);
        format(iStr, sizeof(iStr), "Udv! %s vagyok йs a bar?tod szeretnйk lenni.\nElfogadod?", GetPlayerNameEx(playerid));
        ShowPlayerDialog(guyid, AMIGODIALOG, DIALOG_STYLE_MSGBOX, "?n elfogadja?", iStr, "Igen", "Nem");
        SetPVarInt(guyid, "AmigoRequest", playerid);
        return 1;
    }
I hope that I helped you!.
Reply
#3

You have declared this variable before, however you can do one of the following things:
1) Change the giveplayerid to another variable like 'targetid'.
2) Find the giveplayerid variable and replace it with another variable by using (Control+F).

EDIT: Sorry Stanford. i was too late.
Reply
#4

thanks, 1 problem please help
Код:
error 035: argument type mismatch (argument 1)

	if(sscanf(params, "u", giveplayeride)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
Reply
#5

Change it to the new variable you have declared however it is , or show me your command.
pawn Код:
if(sscanf(params, "u", guyid)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
Reply
#6

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Change it to the new variable you have declared however it is , or show me your command.
pawn Код:
if(sscanf(params, "u", guyid)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
don't work !! please help but not important
Reply
#7

Show me your command?
Reply
#8

full code:
Код:
	if(strcmp(cmd, "/bemutatkoz",true) == 0)
    {
		new giveplayeride;
		if(sscanf(params, "u", giveplayeride)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
		if(playerid == giveplayeride) return SendClientMessage(playerid, 0x33AA33AA, "(( Magadnak nem mutatkozhatsz be! ))");
		new USER_FILE[64];
		format(USER_FILE, sizeof(USER_FILE), "SFSUsers/%s.ini", GetPlayerNameEx(playerid));
		if(DOF2_GetInt(USER_FILE, GetPlayerNameEx(giveplayeride)) == 1) return SendClientMessage(playerid, 0x33AA33AA, "(( Mбr ismeritek egymбst! ))");
		new iStr[70];
		format(iStr, sizeof(iStr), "(( Bemutatkozбs kйrelmet elkьldted neki: %s ))", GetPlayerNameEx(giveplayeride));
		SendClientMessage(playerid, 0x33AA33AA, iStr);
		format(iStr, sizeof(iStr), "Ьdv! %s vagyok йs a barбtod szeretnйk lenni.\nElfogadod?", GetPlayerNameEx(playerid));
		ShowPlayerDialog(giveplayeride, AMIGODIALOG, DIALOG_STYLE_MSGBOX, "Цn elfogadja?", iStr, "Igen", "Nem");
		SetPVarInt(giveplayeride, "AmigoRequest", playerid);
		return 1;
	}
Reply
#9

pawn Код:
new guyid;
if(sscanf(params, "u", guyid)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
Try this
Reply
#10

You are using the OnPlayerCommandText not zcmd or a thing that uses params. You should use cmdtext instead.
pawn Код:
if(sscanf(cmdtext, "u", giveplayeride)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
EDIT: Sorry use cmd not cmdtext if it didn't work.
pawn Код:
if(sscanf(cmd, "u", giveplayeride)) return SendClientMessage(playerid, 0x33AA33AA, "(( /bemutatkoz [playerid] ))");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)