sscanf2 error
#1

Hi,i wanted to add a little sistem of voting sistem,but i'ts giving me this error and i don't know why?

Look:

pawn Код:
D:\Jocuri\Kituri\Server Samp\pawno\include\sscanf2.inc(199) : warning 219: local variable "name" shadows a variable at a preceding level
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.

And this is the line from 199 in sscanf2 :

pawn Код:
name[MAX_PLAYER_NAME];
pawn Код:
{
        new
        name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof (name));
        SSCANF_Join(playerid, name, IsPlayerNPC(playerid));
        #if defined SSCANF_OnPlayerConnect
            SSCANF_OnPlayerConnect(playerid);
        #endif
        return 1;
    }
Reply
#2

You must have declared name already, hit Ctrl + F and find it, then decide which one to use.
Reply
#3

explain this part please?
pawn Код:
{
198        new
199        name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof (name));
        SSCANF_Join(playerid, name, IsPlayerNPC(playerid));
        #if defined SSCANF_OnPlayerConnect
            SSCANF_OnPlayerConnect(playerid);
        #endif
        return 1;
    }
or
pawn Код:
{
199        new
200        name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof (name));
        SSCANF_Join(playerid, name, IsPlayerNPC(playerid));
        #if defined SSCANF_OnPlayerConnect
            SSCANF_OnPlayerConnect(playerid);
        #endif
        return 1;
    }
Reply
#4

199 name[MAX_PLAYER_NAME];
Reply
#5

Try To rename a Variable [name]

PHP код:
{
        new
        
name2[MAX_PLAYER_NAME];
        
GetPlayerName(playerid, name2, sizeof (name2));
        
SSCANF_Join(playerid, name2, IsPlayerNPC(playerid));
        
#if defined SSCANF_OnPlayerConnect
            
SSCANF_OnPlayerConnect(playerid);
        
#endif
        
return 1;
    } 
Reply
#6

Worked,now i will try it in game,hehe,i'll come back if don't working.
Reply
#7

Remove line 198 and 199, you probably have anyone variable somewhere.
Reply
#8

Not working in game,what to do now

in game i have to do this command /ask to do a vot but it's not working.

this is the sistem voting i have it : https://sampforum.blast.hk/showthread.php?tid=286403
Reply
#9

Hello!

Try this:

Add this 2 stocks somewhere in your script, but not in callback!

Stock 1:
PHP код:
stock GetName(playerid)
{
new
name[24];
GetPlayerName(playerid, name, sizeof(name));
return 
name;
} 
Stock 2:

PHP код:
stock SendAdminMessage(color, const string[])
{
    for(new 
i = 0; i < MAX_PLAYERS; i++)
    {
        if(
IsPlayerAdmin[i])
        
SendClientMessage(i, color, string);
    }
    return 
1;
} 
And here is the code for /ask command:

PHP код:
CMD:ask(playerid, params[])
{
    new 
question;
    new 
string[160];
    if(
sscanf(params, "s", question)) return SendClientMessage(playerid, -1, "Usage: /ask [question]");
    
format(string, sizeof(string), "[ASK]: New Question By: %s | Question: %s", GetName(playerid), question);
    
SendAdminMessage(-1, string);
    
SendClientMessage(playerid, -1, "[ASK]: Your Question Has Been Send To an Online Administrator");
    return 
1;
} 
Hope I helped you

Note: I didn't test yet...
Reply


Forum Jump:


Users browsing this thread: