Score Adding and Array Issues - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Score Adding and Array Issues (
/showthread.php?tid=323113)
Score Adding and Array Issues -
Jagofr - 04.03.2012
I have been trying to figure out why this script won't compile by myself but I just can't find the solution can some take a look at this script and tell me whats wrong?
From Line 151 to 156
pawn Код:
//Player Score, Kills and Deaths Set
public OnPlayerDeath(playerid, killerid, reason)
{
  pData[playerid][pScore]++ 1;
  pData[playerid][pDeaths]++ 1;
  pData[killerid][pKills]++ 1;
  return 1;
}
From Line 241 to 267
pawn Код:
case 5:
    {
      if(!response)
      {
        SendClientMessage(playerid,-1,"You need to login to play on this server.");
        Kick(playerid);
      }
      else
      {
        new cpass[40],pass[40];
        new file[100];
        format(file,sizeof(file),USERS,pData[playerid][pName]);
        format(cpass,sizeof(cpass),USERS,pData[playerid][pPass]);
        format(pass,sizeof(pass),"%s",inputtext);
        if(pass != cpass)
        {
          ShowPlayerDialog(playerid,DIALOG_FAILED,DIALOG_STYLE_PASSWORD,"Login!","Incorrect Password! Enter correct password below.","Login","Quit");
        }
        else if(pass == cpass)
        {
          new success[128];
          format(success,sizeof(success),"Welcome back %s. Enjoy the server.",pData[playerid][pName]);
          ShowPlayerDialog(playerid,DIALOG_LOG_SUCCESS,DIALOG_STYLE_MSGBOX,"Success!",success,"Close","");
        }
      }
    }
  }
I get these errors:
Код:
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(152) : error 001: expected token: ";", but found "-integer value-"
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(152) : warning 215: expression has no effect
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(153) : error 001: expected token: ";", but found "-integer value-"
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(153) : warning 215: expression has no effect
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(154) : error 001: expected token: ";", but found "-integer value-"
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(154) : warning 215: expression has no effect
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(177) : error 017: undefined symbol "dcmd_changepass" //I know the reason for this error. No need to correct this one.
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(255) : error 033: array must be indexed (variable "pass")
C:\Documents and Settings\Jamie\Desktop\SAMP Server\filterscripts\JAdmin.pwn(259) : error 033: array must be indexed (variable "pass")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
6 Errors.
Someone help. Thanks.
Re: Score Adding and Array Issues -
FalconX - 04.03.2012
Okay Seems like OnPlayerDeath is wrong..
Your is
replace this
pawn Код:
//Player Score, Kills and Deaths Set
public OnPlayerDeath(playerid, killerid, reason)
{
  pData[playerid][pScore]++ 1;
  pData[playerid][pDeaths]++ 1;
  pData[killerid][pKills]++ 1;
  return 1;
}
with this.
pawn Код:
//Player Score, Kills and Deaths Set
public OnPlayerDeath(playerid, killerid, reason)
{
  pData[playerid][pScore]++;
  pData[playerid][pDeaths]++;
  pData[killerid][pKills]++;
  return 1;
}
Remember when you are using ++ don't put 1 with it as it will increase 1 digit onplayerdeath, always.
Hope this helps.
-FalconX