/readpm Help
#1

Help please. I got 1 Error line. All about readpm I posted now.
The /pm. and /readpm and new Readpm;

But I got Errors on 1 line.

Can anyone help?

Thanks you for helping.

pawn Код:
new Readpm;  [color=yellow] <<< ON THE TOP OF THE SCRIPT[/color]



    if(strcmp("/pm", cmd, true) == 0)
    {
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp) || strlen(tmp) > 5) {
    SendClientMessage(playerid,COLOR_RED,"Usage: /pm (id) (message)");
    return 1;
    }

    new id = strval(tmp);
    gMessage = strrest(cmdtext,idx);

    if(!strlen(gMessage)) {
    SendClientMessage(playerid,COLOR_RED,"Usage: /pm (id) (message)");
    return 1;
    }

    if(!IsPlayerConnected(id)) {
    SendClientMessage(playerid,COLOR_RED,"That ID is not online.");
    }
    new pName[MAX_PLAYER_NAME+1];
    new iName[MAX_PLAYER_NAME+1];
    if(playerid != id) {
    new year, month,day;
    getdate(year, month, day);
    GetPlayerName(id,iName,sizeof(iName));
    GetPlayerName(playerid,pName,sizeof(pName));
    format(string, sizeof(string), "[PM] %s To %s: %s (%d-%d-%d)", pName,iName,gMessage,month,day,year);
    PMLog(string);
    format(Message,sizeof(Message),"[PM] To %s(%d): %s",iName,id,gMessage);
    SendClientMessage(playerid,COLOR_YELLOW,Message);
    format(Message,sizeof(Message),"[PM] From %s(%d): %s",pName,playerid,gMessage);
    SendClientMessage(id,COLOR_YELLOW,Message);
    PlayerPlaySound(id,1085,0.0,0.0,0.0);
    for(new i = 0; i < MAX_PLAYERS; i++)
    if(Readpm[i] == 1)    [color=yellow]<<<<<< ERROR LINE!!![/color]
    {
      format(string, sizeof(string), "[PM] %s To %s: %s", pName,iName,gMessage);
      SendClientMessage(i,COLOR_ORANGE,string);
    }

    printf("PM: %s",Message);
    }
    else {
    SendClientMessage(playerid,COLOR_RED,"You cannot PM yourself");
    }
    return 1;
    }
pawn Код:
if(strcmp(cmd, "/readpm", true) == 0)
    {
        if(PlayerAdminLevel >= 2)
        {
          if(Readpms[playerid] == 0)
          {
              GetPlayerName(playerid, sendername, sizeof(sendername));
              SendClientMessage(playerid, COLOR_BLUE, "You can now see PMs!");
              Readpms == 1;
                format(string, sizeof(string), "[SERVER]: Readpm Able.");
                SendClientMessage(playerid, COLOR_RED, string);
        }
            else
            {
        GetPlayerName(playerid, sendername, sizeof(sendername));
                Readpms == 0;
                format(string, sizeof(string), "[SERVER]: Readpm Disabled.");
                SendClientMessage(playerid, COLOR_RED, string);
            }
        }
        else
        {
          SendClientMessage(playerid, COLOR_CYAN, "You are not authorized to use this command!");
        }
        return 1;
    }
Код:
C:\Users\Bouke\Desktop\Server\Server 1\gamemodes\lvrcrTEST.pwn(5320) : error 028: invalid subscript (not an array or too many subscripts): "Readpm"
C:\Users\Bouke\Desktop\Server\Server 1\gamemodes\lvrcrTEST.pwn(5320) : warning 215: expression has no effect
C:\Users\Bouke\Desktop\Server\Server 1\gamemodes\lvrcrTEST.pwn(5320) : error 001: expected token: ";", but found "]"
C:\Users\Bouke\Desktop\Server\Server 1\gamemodes\lvrcrTEST.pwn(5320) : error 029: invalid expression, assumed zero
C:\Users\Bouke\Desktop\Server\Server 1\gamemodes\lvrcrTEST.pwn(5320) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

Код:
new Readpm[MAX_PLAYERS];   <<< ON THE TOP OF THE SCRIPT
Reply
#3

Almost done. 2 errors left.

pawn Код:
new Readpms[MAX_PLAYERS];  <<< ON TOP OF SCRIPT
pawn Код:
if(strcmp("/pm", cmd, true) == 0)
    {
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp) || strlen(tmp) > 5) {
    SendClientMessage(playerid,COLOR_RED,"Usage: /pm (id) (message)");
    return 1;
    }

    new id = strval(tmp);
    gMessage = strrest(cmdtext,idx);

    if(!strlen(gMessage)) {
    SendClientMessage(playerid,COLOR_RED,"Usage: /pm (id) (message)");
    return 1;
    }

    if(!IsPlayerConnected(id)) {
    SendClientMessage(playerid,COLOR_RED,"That ID is not online.");
    }
    new pName[MAX_PLAYER_NAME+1];
    new iName[MAX_PLAYER_NAME+1];
    if(playerid != id) {
    new year, month,day;
    getdate(year, month, day);
    GetPlayerName(id,iName,sizeof(iName));
    GetPlayerName(playerid,pName,sizeof(pName));
    format(string, sizeof(string), "[PM] %s To %s: %s (%d-%d-%d)", pName,iName,gMessage,month,day,year);
    PMLog(string);
    format(Message,sizeof(Message),"[PM] To %s(%d): %s",iName,id,gMessage);
    SendClientMessage(playerid,COLOR_YELLOW,Message);
    format(Message,sizeof(Message),"[PM] From %s(%d): %s",pName,playerid,gMessage);
    SendClientMessage(id,COLOR_YELLOW,Message);
    PlayerPlaySound(id,1085,0.0,0.0,0.0);
    for(new i = 0; i < MAX_PLAYERS; i++)
    if(Readpms[i] == 1)
    {
      format(string, sizeof(string), "[PM] %s To %s: %s", pName,iName,gMessage);
      SendClientMessage(i,COLOR_ORANGE,string);
    }

    printf("PM: %s",Message);
    }
    else {
    SendClientMessage(playerid,COLOR_RED,"You cannot PM yourself");
    }
    return 1;
    }
pawn Код:
if(strcmp(cmd, "/readpm", true) == 0)
    {
        if(PlayerAdminLevel[playerid] >= 2)
        {
          if(Readpms[playerid] == 0)
          {
              Readpms == 1;   <<<<< ERROR LINE
                format(string, sizeof(string), "[SERVER]: Readpm Able.");
                SendClientMessage(playerid, COLOR_RED, string);
        }
            else
            {
                Readpms == 0;  <<<<< ERROR LINE
                format(string, sizeof(string), "[SERVER]: Readpm Disabled.");
                SendClientMessage(playerid, COLOR_RED, string);
            }
        }
        else
        {
          SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command!");
        }
        return 1;
    }

Код:
C:\Users\Bouke\Desktop\Server\Server 1\gamemodes\lvrcrTEST.pwn(5689) : error 033: array must be indexed (variable "Readpms")
C:\Users\Bouke\Desktop\Server\Server 1\gamemodes\lvrcrTEST.pwn(5695) : error 033: array must be indexed (variable "Readpms")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

Код:
Readpms == 1;   <<<<< ERROR LINE

Readpms == 0;  <<<<< ERROR LINE
Make them

Код:
Readpms[playerid] = 1;
And 
Readpms[playerid] = 0;
Reply
#5

Thanks
Reply
#6

My Pleasure
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)