Errors in Compiler? Help!
#1

Hello,

I have just finished making a /call 911 command, but I get these errors:

Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(810) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(811) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1102) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1108) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1445) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1563) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1563) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1636) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1642) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1690) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1705) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1741) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1778) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1835) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1873) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1882) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1943) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(1943) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2003) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2033) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2058) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2063) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2177) : warning 219: local variable "str" shadows a variable at a preceding level
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2194) : error 001: expected token: "(", but found "-integer value-"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2194) : error 001: expected token: ";", but found "("
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2199) : error 010: invalid function or declaration
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2200) : error 010: invalid function or declaration
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2204) : error 021: symbol already defined: "GetPlayerName"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2207) : error 010: invalid function or declaration
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2209) : warning 203: symbol is never used: "message"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2209) : warning 203: symbol is never used: "pName"
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\LOSSAN~1\GAMEMO~1\MySQL.pwn(2209) : warning 203: symbol is never used: "str"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.
I think it has something to do with this:

pawn Код:
CMD:call 911(playerid, params[])

And if I change CMD:call 911 to CMD:call it gives no errors, but then how am I supposed to do /call 911?

Heres my whole command,

pawn Код:
CMD:call 911(playerid, params[])
{
    new
        message[128];

    if(sscanf(params, "s", message))
        return SendUsageError( playerid, "/call 911 [Message]" );
    new
        str[128],
        pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(str, sizeof(pName), "[911] %s has called 911! Message: %s", pName, message);
    SendClientMessage(playerid, COP_MESSAGE, str);
    return 1;
}
Please help! Thanks
Reply
#2

if im not sure you are not allowed to have call 911 with spaces.
and for other errors. it says that there is already a variable for pName and str

i suggest using strcmp if you really want a command with spaces on it

Example
pawn Код:
new
    call911[24]
;

if(!strcmp(call911, "911", true))
{
//code here
}
EDIT

Here you go. but i think Misiur is much better one you can use his or mine you're choice
pawn Код:
CMD:call 911(playerid, params[])
{
    new
        message[128],
        call911[24]
    ;

    if(sscanf(params, "s[24]", call911))
        return SendUsageError( playerid, "/call 911 [Message]" );
       
    if(!strcmp(call911, "911", true))
    {
        new
            str[128],
            pName[MAX_PLAYER_NAME]
        ;
        GetPlayerName(playerid, pName, sizeof(pName));
        format(str, sizeof(pName), "[911] %s has called 911! Message: %s", pName, message);
        SendClientMessage(playerid, COP_MESSAGE, str);
    }
    return 1;
}
Reply
#3

pawn Код:
if(sscanf(params, "s", message))
Sscanf takes string length parameter now.

pawn Код:
CMD:call 911(playerid, params[])
This is invalid function name. You can't have space in there

#e:
pawn Код:
CMD:call(playerid, params[])
{
    new
        message[128];
    sscanf(params, "d", number);
    if(911 == number) {
        if(sscanf(params, "{d}s[128]", message))
            return SendUsageError( playerid, "/call 911 [Message]" );
        new
            str[128],
            pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        format(str, sizeof(pName), "[911] %s has called 911! Message: %s", pName, message);
        SendClientMessage(playerid, COP_MESSAGE, str);
    }
    return 1;
}
Reply
#4

Alright but how can I make the command /call 911 without getting the errors?
Reply
#5

I've tried this, but nothing happens? No messages show up, nothing?

pawn Код:
CMD:call(playerid, params[])
{
    new
        number;
    sscanf(params, "d", number);
    if(911 == number)
    {

        new
            message[128];

        if(sscanf(params, "s", message))
            return SendUsageError( playerid, "/call 911 [Message]" );
        new
            str[128],
            str1[128],
            pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        SendClientMessage(playerid, COP_MESSAGE, "----------------------------------------------------------");
        SendClientMessage(playerid, COP_MESSAGE, "[!] New 911 call! [!]");
        format(str, sizeof(pName), "[!] Caller: %s", pName);
        format(str, sizeof(pName), "[!] Message: %s", message);
        SendClientMessage(playerid, COP_MESSAGE, "----------------------------------------------------------");
        SendClientMessage(playerid, COP_MESSAGE, str);
        SendClientMessage(playerid, COP_MESSAGE, str1);
    }
    return 1;
}
Reply
#6

pawn Код:
sscanf(params, "d", number);
//change to
sscanf(params, "d{s[128]}", number);
The number isn't extracted

Also you have later to use
pawn Код:
if(sscanf(params, "{d}s[128]", message))
Because the 911 will be a part of a message
Reply
#7

Код:
CMD:call(playerid, params[])
{
    new
        number;
    new message[128];
    if(sscanf(params, "is[128]", number); return SendUsageError( playerid, "/call 911 [Message]" );
    if(number == 911)
    {
        new
            stri[128],
            stri1[128],
            pNamee[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pNamee, sizeof(pNamee));
        SendClientMessage(playerid, COP_MESSAGE, "----------------------------------------------------------");
        SendClientMessage(playerid, COP_MESSAGE, "[!] New 911 call! [!]");
        format(stri, sizeof(pNamee), "[!] Caller: %s", pNamee);
        format(stri, sizeof(pNamee), "[!] Message: %s", message);
        SendClientMessage(playerid, COP_MESSAGE, "----------------------------------------------------------");
        SendClientMessage(playerid, COP_MESSAGE, stri);
        SendClientMessage(playerid, COP_MESSAGE, stri1);
    }
    return 1;
Reply
#8

pawn Код:
CMD:call(playerid, params[])
{
    new message[128], phonenumb;
    phonenumb = strval(params);
    if(sscanf(params, "us[64]", phonenumb, params)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE:/call [number] [text]");
    if(phonenumb == 911)
    {
        new str[128], pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        format(str, sizeof(pName), "[911] %s has called 911! Message: %s", pName, message);
        SendClientMessage(playerid, COP_MESSAGE, str);
    }
    if(phonenumb != 911) return SendClientMessage(playerid, 0xFFFFFFFF, "You can only call 911 at the moment.");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)