SA-MP Forums Archive
Need help with 2 cmds.. - 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: Need help with 2 cmds.. (/showthread.php?tid=386003)



Need help with 2 cmds.. - Ryan_Redfield - 18.10.2012

Hello guys.
I'm a scripter on a roleplay server.
We are 3 scripters on that server but the owner wand to kick 2 of us.He told to make 2 temporary(/tempvip,/tempadmin) cmds for his server.I tried a lot but both cmds I made is permanent not temporary.I need cmds that expire after sometime(vip/admin feature auto-expire after 1 hour or more).Our server script is ng:rp based.I really love that server.I dont want to lost my adminship.
Please help me guys.

Forgive me for my bad English.


Re: Need help with 2 cmds.. - RedJohn - 18.10.2012

Can you post what you've done so far?


Respuesta: Need help with 2 cmds.. - AaronKillz - 18.10.2012

So he'll fire you if you don't make the commands? lmfao
You can use if statements and save them to the player's userfile.

Which saving system are you using?

CMD:tempadmin(playerid, params[])
{
maketempadmin[playerid] = 1;
blah blah...


Re: Need help with 2 cmds.. - Dizzle - 18.10.2012

Why dont you make it like if they disconnect, they lose their admin level, like Aaron said but put

add this on top of your script

Код:
new maketempadmin[MAX_PLAYERS];
then use this in your command to se the player's temp level

Код:
maketempadmin[playerid] = 1;
then put this under OnPlayerDisconnect.

Код:
maketempadmin[playerid] = 0;



Re: Need help with 2 cmds.. - Ryan_Redfield - 19.10.2012

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
Can you post what you've done so far?
I made this cmd for temp admin...I test it on my pc but I doubt its a permanent feature...
CMD:maketempadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 99999)
{
new Target;
new Level;
if(!sscanf(params, "ui", Target, Level))
{
if(Level > 99999) return SendClientMessage( playerid, COLOR_WHITE, "SERVER: Maximum level is 99999!" );
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: player ID not available");
PlayerInfo[Target][pAdmin] = Level;
PlayerInfo[Target][pTempLevel] = Level;
new tname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
new MyString[128];
new TargetString[128];
format(MyString,sizeof MyString, "You have set %s temporary Admin Level to %i!", tname, Level);
format(TargetString,sizeof TargetString, "You are now temporary Admin Level %i, by %s!", Level, pname);
SendClientMessage(Target, COLOR_RED, TargetString);
SendClientMessage(playerid, COLOR_LIGHTBLUE, MyString);
}
else SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /maketempadmin <playerid> <temp-level>");
}
else SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorized to perform this command!");
return 1;
}


Re: Need help with 2 cmds.. - gtakillerIV - 19.10.2012

Not really easy to make one if you want it with days, months, and hours. Open LuxAdmin and see how it works, you will say it's very hard


Re: Need help with 2 cmds.. - RanSEE - 19.10.2012

Код:
CMD:tempadmin(playerid, params[])
{
   new Player, tempadmin;
   if(sscanf2(params, "ui", Player, Level))
   {
   if(PlayerInfo[playerid][pAdminLevel] > 4)
   {
   if(IsPlayerConnected(playerid) && IsPlayerConnected(Player))
   {
      if(gPlayerLogged[playerid] == 1)
      {
          new Player;
           new Level;
          {
              if(Player == playerid) return SendClientMessage(playerid, COLOR_RED, "SERVER: Cant perform this command on yourself!" );
            if(Level > 3) return SendClientMessage(Playerid, COLOR_RED, "SERVER: Maximum level is 2!" );
                if(Player == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Wrong player ID");
                if(PlayerInfo[Player][pAdminLevel] >= PlayerInfo[playerid][pAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cant perform this on Admins that are equal or higher than your level!");
            PlayerInfo[Player][pAdminLevel] = Level;
            PlayerInfo[Player][pTempLevel] = Level;
            new tname[MAX_PLAYER_NAME];
            GetPlayerName(Player,tname,sizeof(tname));
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid,pname,sizeof(pname));
            new MyString[128];
            new TargetString[128];
            format(MyString,sizeof MyString, "You have set %s temporary Admin Level to %i!", tname, Level);
            format(TargetString,sizeof TargetString, "You are now temporary Admin Level %i, thanks to %s!", Level, pname || Any kind of abuse will get you warned/banned from server);
            SendClientMessage(Target, COLOR_RED, TargetString);
            SendClientMessage(playerid, COLOR_GREEN, MyString);
            new File:Log = fopen(adminPATH, io_append);
             new logData[128];
            new fTime[6];
            getdate(fTime[0], fTime[1], fTime[2]);
            gettime(fTime[3], fTime[4], fTime[5]);
            format(logData, sizeof logData, "[%02d/%02d/%04d || %02d:%02d:%02d]%s made %s temporary Admin Level: %d!\r\n", fTime[2], fTime[1], fTime[0], fTime[3], fTime[4], fTime[5], pname, tname, Level);
            fwrite(Log, logData);
            fclose(Log);
          }
          else SendClientMessage(playerid, COLOR_RED, "USAGE: /tempadmin <playerid> <temp-level>");
      }
      else SendClientMessage(playerid,red,"ERROR: You must be logged in to perform this command!");
   }
   else SendClientMessage(playerid, red, "ERROR: You have to be an Admin level 4 or higher to perform this command!");
   return 1;
}
Код:
CMD:tempvip(playerid, params[])
{
   new Player, TempPrem;
   if(sscanf2(params, "ui", Player, Level))
   if(PlayerInfo[playerid][pAdminLevel] > 4)
   {
   if(IsPlayerConnected(playerid) && IsPlayerConnected(Player))
   {
      if(gPlayerLogged[playerid] == 1)
      {
          new Player;
           new Level;
          {
              if(Player == playerid) return SendClientMessage(playerid, COLOR_RED, "SERVER: Cant perform this command on yourself!" );
            if(Level > 3) return SendClientMessage(playerid, COLOR_RED, "SERVER: Maximum level is 2!");
                if(Player == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Wrong player ID");
                if(PlayerInfo[Player][pAdminLevel] > 4) return SendClientMessage(playerid,red,"ERROR: You cant perform this on Admins that are equal or higher than your level!");
            PlayerInfo[Player][pPremiumlevel] = Level;
            PlayerInfo[Player][pTempPremium] = Level;
            new tname[MAX_PLAYER_NAME];
            GetPlayerName(Player,tname,sizeof(tname));
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid,pname,sizeof(pname));
            new MyString[128];
            new TargetString[128];
            format(MyString,sizeof MyString, "You have set %s temporary Premium Level to %i!", tname, Level);
            format(TargetString,sizeof TargetString, "You are now temporary Premium Level %i, thanks to %s!", Level, pname);
            SendClientMessage(Player, COLOR_RED, TargetString);
            SendClientMessage(playerid, COLOR_GREEN, MyString);
          }
          else SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /tempvip <playerid> <temp-level>");
      }
      else SendClientMessage(playerid,red,"ERROR: You must be logged in to perform this command!");
   }
   else SendClientMessage(playerid, red, "ERROR: You have to be an Admin level 4 or higher to perform this command!");
   return 1;
}
He will fire you lol.
PS: I had these commands somewhere lol.