SA-MP Forums Archive
aod cmd help - 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: aod cmd help (/showthread.php?tid=641624)



aod cmd help - STRIKER19501 - 18.09.2017

hello there ,i am having aod cmd it works fine but i want it like when i type aod i get all things and when typed again every thing goes to normal here is my cmd
Код:
CMD:aod(playerid,params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)  
	{
  	ResetPlayerWeapons(playerid); 
  	SendClientMessage(playerid,COLOR_GREY,"{1AE694}» {EA15D5}You're now on duty. (Dont abuse it"); 
  	GivePlayerWeapon(playerid,43,100);
  	SetPlayerSkin(playerid,294);
  	SetPlayerHealth(playerid,999999); 
  	SetPlayerColor(playerid,0xEA15D5C8);
  	new Text3D:label = Create3DTextLabel("ADMIN ON DUTY!", 0xEA15D5C8, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
	}
 	else
	{
        SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this cmd");
	}
	return 1;
}
help me out pls


Re: aod cmd help - Zedder - 18.09.2017

you need to use a global variable for that such as:
PHP код:

new aod[MAX_PLAYERS];
OnPlayerConnect(playerid)
{
    
aod[playerid] = 0;//add this on playerconnect so that it will set 0 for all the players
    
return 1;
}
CMD:aod(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)  
    {
        if(
aod[playerid] == 0)
{
        
aod[playerid] = 1;
      
ResetPlayerWeapons(playerid); 
      
SendClientMessage(playerid,COLOR_GREY,"{1AE694}» {EA15D5}You're now on duty. (Dont abuse it"); 
      
GivePlayerWeapon(playerid,43,100);
      
SetPlayerSkin(playerid,294);
      
SetPlayerHealth(playerid,999999); 
      
SetPlayerColor(playerid,0xEA15D5C8);
      new 
Text3D:label Create3DTextLabel("ADMIN ON DUTY!"0xEA15D5C830.040.050.040.00);
        
Attach3DTextLabelToPlayer(labelplayerid0.00.00.7);
}
        else
{
       
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
       
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
       
SetPlayerArmour(playeridPlayerInfo[playerid][pArmour]);
      
SetPlayerColor(playerid0xFFFFFF00);
      
Delete3DTextLabel(label[playerid]);
     
aod[playerid] = 0//reset it to 0 so that they can use the cmd again
      //add more stuffs to reset or normalize as a normal player
}
    }
     else
    {
        
SendClientMessage(playeridCOLOR_RED"You are not allowed to use this cmd");
    }
    return 
1;

Sorry but i edited that inside the sa-mp forum, thats why there maybe some loose indentation warnings.


Re: aod cmd help - STRIKER19501 - 19.09.2017

Quote:
Originally Posted by Zedder
Посмотреть сообщение
you need to use a global variable for that such as:
PHP код:

new aod[MAX_PLAYERS];
OnPlayerConnect(playerid)
{
    
aod[playerid] = 0;//add this on playerconnect so that it will set 0 for all the players
    
return 1;
}
CMD:aod(playerid,params[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1)  
    {
        if(
aod[playerid] == 0)
{
        
aod[playerid] = 1;
      
ResetPlayerWeapons(playerid); 
      
SendClientMessage(playerid,COLOR_GREY,"{1AE694}» {EA15D5}You're now on duty. (Dont abuse it"); 
      
GivePlayerWeapon(playerid,43,100);
      
SetPlayerSkin(playerid,294);
      
SetPlayerHealth(playerid,999999); 
      
SetPlayerColor(playerid,0xEA15D5C8);
      new 
Text3D:label Create3DTextLabel("ADMIN ON DUTY!"0xEA15D5C830.040.050.040.00);
        
Attach3DTextLabelToPlayer(labelplayerid0.00.00.7);
}
        else
{
       
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
       
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
       
SetPlayerArmour(playeridPlayerInfo[playerid][pArmour]);
      
SetPlayerColor(playerid0xFFFFFF00);
      
Delete3DTextLabel(label[playerid]);
     
aod[playerid] = 0//reset it to 0 so that they can use the cmd again
      //add more stuffs to reset or normalize as a normal player
}
    }
     else
    {
        
SendClientMessage(playeridCOLOR_RED"You are not allowed to use this cmd");
    }
    return 
1;

Sorry but i edited that inside the sa-mp forum, thats why there maybe some loose indentation warnings.
hay thnx it worked and u just teached me how to use those variable thingy +rep