SA-MP Forums Archive
[HELP] /refilladm command - 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: [HELP] /refilladm command (/showthread.php?tid=96872)



[HELP] /refilladm command - breakpaper - 11.09.2009

hello
can anybody make a /refilladm command for admins
the can do everywhere do the command!
this is the normal command:
Код:
if(strcmp(cmd, "/refill", true) == 0)
	{
	  if(IsPlayerConnected(playerid) == 1)
	  {
	    if(IsPlayerInAnyVehicle(playerid) == 1)
	    {
	      if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	      {
         if(IsAtGasStation(playerid) == 1)
	        {
	          if(GetVehType(GetPlayerVehicleID(playerid)) == 4)
	          {
							SendPlayerRandomizeText(playerid,GREENIE,GAS_SERVICE_TEXT);
	        		TogglePlayerControllable(playerid,0); ChoosingGas[playerid] = 1;
						}
						else
						{
						  SendMessage(playerid,WHITE,"[*] You can't fill this vehicle.");
						}
	        }
	        else
	        {
	          SendMessage(playerid,WHITE,"[*] You're not at Gas station.");
	        }
	      }
	      else
	      {
	        SendMessage(playerid,WHITE,"[*] You're not a driver.");
	      }
	    }
			else
	    {
				SendMessage(playerid,WHITE,"[*] You're not in a vehicle.");
	    }
	  }
	  return 1;
	}
	return 0;
}



Re: [HELP] /refilladm command - Finn - 11.09.2009

Can't help much not knowing your script at all;

pawn Код:
if(strcmp(cmd, "/refilladm", true) == 0)
{
  if(IsPlayerAdmin(playerid))
  {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
      Fuel[GetPlayerVehicleID(playerid)] = 999; // Change the array name & value to the correct ones
      return SendMessage(playerid,WHITE,"[*] Vehicle refilled.");
    }
    else return SendMessage(playerid,WHITE,"[*] You're not driving a vehicle.");
  }
  else return SendMessage(playerid,WHITE,"[*] You're not an admin.");
}
BTW, if you cannot do this easy code (just about adding IsPlayerAdmin() in the code), I really think you shouldn't be scripting gamemodes at all. First learn to script, then start making gamemodes. I bet this your gamemode is a GF-edit anyway.


Re: [HELP] /refilladm command - breakpaper - 11.09.2009

it's a filterscript
and if i do it there is standing errors!
EDIT:it don't work!
there is standing: you are not an admin!


Re: [HELP] /refilladm command - (.Aztec); - 12.09.2009

Quote:
Originally Posted by breakpaper
it's a filterscript
and if i do it there is standing errors!
EDIT:it don't work!
there is standing: you are not an admin!
You have to login as an RCON Administrator. (/rcon login)


Re: [HELP] /refilladm command - breakpaper - 12.09.2009

can't you make a /refilladm for admin's from level 1?
so by name.ini and there in:
adminlevel=1
and then you can do /refilladm


Re: [HELP] /refilladm command - Blades - 12.09.2009

Put this anywhere
pawn Код:
stock PlayerName(playerid) {
 GetPlayerName(playerid, name, 255);
 return name;
}
pawn Код:
if(strcmp(cmd, "/refilladm", true) == 0)
{
  if(dini_Get(PlayerName(playerid), "adminlevel") >= 1)
  {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
      Fuel[GetPlayerVehicleID(playerid)] = 999; // Change the array name & value to the correct ones
      return SendMessage(playerid,WHITE,"[*] Vehicle refilled.");
    }
    else return SendMessage(playerid,WHITE,"[*] You're not driving a vehicle.");
  }
  else return SendMessage(playerid,WHITE,"[*] You're not an admin.");
}
Based of Finn's reply
Untested, might not work.
Also you should get the PlayerName thingy