SA-MP Forums Archive
Can't solve it, hopeless please help me. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Can't solve it, hopeless please help me. (/showthread.php?tid=180646)



Can't solve it, hopeless please help me. - Scriptissue - 02.10.2010

I tired to make Adminduty script that only if the player is already an Admin he can use, but It doesn't work everyplayer can use that command.
pawn Код:
if(strcmp("/Adminduty", cmdtext, true, 6) == 0)
{
new pfile[256];

GetPlayerName(playerid, playername1, sizeof(playername1));
format(pfile,sizeof(pfile),"Users/%s.ini",playername1);
    if(!dini_Exists(pfile)) { dini_Create(pfile);
 dini_Set(pfile,"Admin",tmp);
 }
 new string[64];
   if(!dini_Exists(pfile)) { format(string, sizeof(string), "Permission denied !");
   SendClientMessage(playerid, 0xFF4646FF, string);
   return 1;
    }
    new logged[MAX_PLAYERS];

if(!strcmp(tmp,dini_Get(pfile,"Admin"),true)) { logged[playerid] = 1;

      SendClientMessage(playerid, 0xFF4646FF, " You are now on Adminduty");
       } else { SendClientMessage(playerid, 0xFF4646FF, " Error: Invalid password "); }
     
SetPlayerColor(playerid,0x057AA0FF);





    return 1;
}



Re: Can't solve it, hopeless please help me. - samgreen - 02.10.2010

This code is very messy and disorganized. I cleaned the code up and put it on pastebin, but I don't really understand what you are trying to accomplish. Can you explain a bit more?


Re: Can't solve it, hopeless please help me. - bigcomfycouch - 02.10.2010

He's attempting to make it so only admins can use that command. This might work.

http://pastebin.com/EJzSbfr3