Openbay(gate) 2 commands into 1
#3

Simple but there are many ways but this is one way, use sscanf of ******

Код:
CMD:bay(playerid,params[]) 
{ 
    if((PlayerInfo[playerid][pFaction] != 2) && (PlayerInfo[playerid][pFaction] != 3)) 
    	return SCM(playerid, COLOR_LIGHTRED, "You're not a Faction member."); 
    new szType[5];
    if(sscanf(params, "s[5]", szType)) return SCM(playerid, -1, "USAGE: /bay [open/close]");
    if(strcmp(szType, "open", true) == 0)
    {

        if(IsPlayerInRangeOfPoint(playerid, 8.0,-2534.17944, 2347.45361, 5.94538)) 
        	MoveObject(fdgate1,-2534.1794, 2348.4136, 7.8590,0.50,0.00000, 90.0000, 90.0000); 
   
        else if(IsPlayerInRangeOfPoint(playerid, 7.0,-2526.27173, 2347.45361, 5.94540)) 
        	MoveObject(fdgate2,-2526.2717, 2348.4136, 7.8590,0.50,0, 90, 90); 
        
        else if(IsPlayerInRangeOfPoint(playerid, 7.0,-2518.36084, 2347.45361, 5.94540)) 
        	MoveObject(fdgate3,-2518.3608, 2348.4136, 7.8590,0.50,0, 90, 90); 
        
    }
    else if(strcmp(szType, "close", true) == 0)
    {
    	if(IsPlayerInRangeOfPoint(playerid, 8.0,-2534.17944, 2347.45361, 5.94538)) 
    		MoveObject(fdgate1,-2534.17944, 2347.45361, 5.94538,0.50,0.00000, 0.0000, 90.0000); 
        
        else if(IsPlayerInRangeOfPoint(playerid, 7.0,-2526.27173, 2347.45361, 5.94540)) 
        	MoveObject(fdgate2,-2526.27173, 2347.45361, 5.94540,0.50,0, 0, 90); 
         
        else if(IsPlayerInRangeOfPoint(playerid, 7.0,-2518.36084, 2347.45361, 5.94540)) 
        	MoveObject(fdgate3,-2518.36084, 2347.45361, 5.94540,0.50,0, 0, 90); 
        
    }
    else SCM(playerid, -1, "Invalid Choice!");
    return 1; 
}
@EDIT: use ^ much simplier lol.
Reply


Messages In This Thread
Openbay(gate) 2 commands into 1 - by Cubie - 26.09.2017, 14:28
Re: Openbay(gate) 2 commands into 1 - by 10MIN - 26.09.2017, 14:43
Re: Openbay(gate) 2 commands into 1 - by ToiletDuck - 26.09.2017, 14:46
Re: Openbay(gate) 2 commands into 1 - by Cubie - 26.09.2017, 15:47
Re: Openbay(gate) 2 commands into 1 - by ToiletDuck - 26.09.2017, 15:50
Re: Openbay(gate) 2 commands into 1 - by Cubie - 27.09.2017, 10:50
Re: Openbay(gate) 2 commands into 1 - by MEW273 - 27.09.2017, 11:35
Re: Openbay(gate) 2 commands into 1 - by Cubie - 27.09.2017, 12:08

Forum Jump:


Users browsing this thread: 1 Guest(s)