array must indexed help me plz
#1

CoDE:
if(PlayerInfo[playerid][InDM] == 1)
{
new aName[MAX_PLAYER_NAME], string2[128];
GetPlayerName(playerid, aName,sizeof(aName));
format(string2,sizeof(string2),"[DM] %s[%i] : {FFFFFF}%s",aName,playerid,text);
printf(string2);
SendClientMessageToAll(GetPlayerColor(playerid),st ring2);
return 0;
}

Error:
error 033: array must be indexed (variable "InDM")
Reply
#2

Are you declaring that variable anywhere? show us that part or whole enum
Reply
#3

yea of course, see this
new InDM[MAX_PLAYERS];
Reply
#4

PHP код:
if(InDM[playerid] == 1)
{
new 
aName[MAX_PLAYER_NAME], string2[128];
GetPlayerName(playeridaName,sizeof(aName));
format(string2,sizeof(string2),"[DM] %s[%i] : {FFFFFF}%s",aName,playerid,text);
printf(string2);
SendClientMessageToAll(GetPlayerColor(playerid),string2);
return 
0;

This should work.
You simple trying to access the array from enum, which is not in the enum :/
Just use
PHP код:
InDM[playerid] = value 
instead of using PlayerInfo enum :/
Reply
#5

thx sir!! for help me!!! and sir can u help me for this system

-i want to add this system which will give 25 score and 15000 cash when new players will registered in my server.
My gamemode is COD/TDM
Reply
#6

After your register code, just add:
PHP код:
SetPlayerScore(playerid,25);
GivePlayerMoney(playerid,15000); 
Reply
#7

Quote:
Originally Posted by karemmahmed22
Посмотреть сообщение
After your register code, just add:
PHP код:
SetPlayerScore(playerid,25);
GivePlayerMoney(playerid,15000); 
dude can u make a proper code or add it on ur script or others script and post it here!!!!
Reply
#8

Hm, idk what you mean but, you don't need huge code to do it
Just those lines in your register system, if you cannot do it, show me your (OnDialogResponse) i will add it for you
Reply
#9

PHP код:
case 125:
        {
           if(!
response)
           {
                
Kick(playerid);
           }
           if (
udb_Exists(PlayerName2(playerid))) {
              if (
udb_CheckLogin(PlayerName2(playerid),inputtext))
              {
               new 
file[256], tmp3[100], string[128];
                  
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );
                  
GetPlayerIp(playerid,tmp3,100);
                  
dini_Set(file,"ip",tmp3);
               
LoginPlayer(playerid);
               
SetPlayerScore(playerid,25);
               
GivePlayerMoney(playerid,15000);
               
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
               if(
PlayerInfo[playerid][Level] > 0) {
                   
format(string,sizeof(string),"Logged In As An Administrator (Level %d)"PlayerInfo[playerid][Level] );
                   new 
text[128];
               
format(textsizeof(text), "You Are Rank %s."GetRankName(playerid));
                 
SendClientMessage(playeridCOLOR_PINKtext);
                   return 
SendClientMessage(playerid,red,string);
                  } else return 
SendClientMessage(playerid,red,"Logged In As A Registered Player.");
           }
           else {
               
PlayerInfo[playerid][FailLogin]++;
               
printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)"PlayerName2(playerid),inputtextPlayerInfo[playerid][FailLogin] );
               if(
PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
               {
                   new 
string[128]; format(stringsizeof(string), "%s Has Been Kicked From CODWW-2 Server Because He Failed To Login"PlayerName2(playerid) );
                   
SendClientMessageToAll(C_PINKstring);
                   print(string);
                   
Kick(playerid);
                   }
              }
        }
        new 
string[200];
        
format(stringsizeof(string),""cwhite"Welcome "cred"%s "cwhite"you are already registered\nKindly enter password to login to your account\n"cred"Incorrect password!"PlayerName2(playerid));
        
ShowPlayerDialog(playerid125DIALOG_STYLE_INPUT"Login",string,"Login","Kick");
    }
    case 
126:
    {
       if(!
response)
       {
         
Kick(playerid);
       }
      if (
strlen(inputtext) < || strlen(inputtext) > 20) {
          new 
string[200];
          
format(stringsizeof(string),""cwhite"Welcome "cred"%s "cwhite"you are not registered\nKindly enter password to register your account\n"cred"Invalid password length"PlayerName2(playerid));
       
ShowPlayerDialog(playerid126DIALOG_STYLE_INPUT"Register",string,"Register","Kick");
      }
      if (!
udb_Exists(PlayerName2(playerid))) {
      if (
udb_Create(PlayerName2(playerid),inputtext))
      {
        new 
file[256],name[MAX_PLAYER_NAME], tmp3[100];
        new 
strdate[20], year,month,day;    getdate(yearmonthday);
        
GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(name));
         
GetPlayerIp(playerid,tmp3,100);    dini_Set(file,"ip",tmp3);
//        dini_Set(file,"password",params);
        
dUserSetINT(PlayerName2(playerid)).("registered",1);
           
format(strdatesizeof(strdate), "%d/%d/%d",day,month,year);
        
dini_Set(file,"RegisteredDate",strdate);
        
dini_Set(file,"Nick",name);
        
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
        
dUserSetINT(PlayerName2(playerid)).("banned",0);
        
dUserSetINT(PlayerName2(playerid)).("level",0);
        
dUserSetINT(PlayerName2(playerid)).("LastOn",0);
        
dUserSetINT(PlayerName2(playerid)).("money",15000);
        
dUserSetINT(PlayerName2(playerid)).("Score",15);
        
dUserSetINT(PlayerName2(playerid)).("kills",0);
           
dUserSetINT(PlayerName2(playerid)).("deaths",0);
           
dUserSetINT(PlayerName2(playerid)).("hours",0);
           
dUserSetINT(PlayerName2(playerid)).("minutes",0);
           
dUserSetINT(PlayerName2(playerid)).("seconds",0);
           
dUserSetINT(PlayerName2(playerid)).("dRank",0);
        
PlayerInfo[playerid][LoggedIn] = 1;
        
PlayerInfo[playerid][Registered] = 1;
        
SendClientMessage(playeridgreen"Sucessfully registred, you got $15000 + 15 score as bonus");
        
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
      }
     }
    }
    case 
183:
    {
        if(!
response)
        {
          
ShowPlayerDialog(ID[playerid],183,DIALOG_STYLE_INPUT,"Password After Changing The Name","You Must Added A New Password For Your New Name\n{FF0000}Or Your Account Will Be Lost!","Set","");
        }
        new 
string[128];
        
dUserSetINT(PlayerName2(ID[playerid])).("password_hash",udb_hash(inputtext) );
        
PlayerPlaySound(ID[playerid],1057,0.0,0.0,0.0);
        
format(stringsizeof(string),"You Have Successfully Changed Your Password To \"%s\"",inputtext);
        
SendClientMessage(ID[playerid],yellow,string);
       }
    } 
Reply
#10

Put your code inside tags
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)