Jump to content
  • 0

Help Commands


M4c

Question

Care ma poate ajuta sa fac comenzile astea cu sscanf, zcmd l-am facut eu dar am incercat sa le fac si sscanf si nu am reusit.

CMD:jetpack(playerid,params[]) {
    if(!strlen(params))	{
    	if(PlayerInfo[ playerid ][Level] >= 0 || IsPlayerAdmin(playerid)) {
			SendClientMessage(playerid,blue,"Jetpack Spawned.");
			CMDMessageToAdmins(playerid,"JETPACK");
			return SetPlayerSpecialAction(playerid, 2);
		} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	} else {
	    new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
    	player1 = strval(params);
		if(PlayerInfo[ playerid ][Level] >= 2)	{
		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)	{
				SetPlayerSpecialAction(player1, 2);
				GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
				format(string,sizeof(string),"Administrator \"%s\" has given you a jetpack",adminname); SendClientMessage(player1,blue,string);
				format(string,sizeof(string),"You have given %s a jetpack", playername);
				return SendClientMessage(playerid,blue,string);
			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
		} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	}
}
CMD:lockcar(playerid,params[]) {
	#pragma unused params
    if(PlayerInfo[ playerid ][Level] >= 0) {
	    if(IsPlayerInAnyVehicle(playerid)) {
		 	for(new i = 0; i < MAX_PLAYERS; i++) SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,false,true);
			CMDMessageToAdmins(playerid,"LOCKCAR");
			PlayerInfo[ playerid ][DoorsLocked] = 1;
			new string[128]; format(string,sizeof(string),"Locked vehicle.", pName(playerid));
			return SendClientMessageToAll(blue,string);
		} else return SendClientMessage(playerid,red,"ERROR: You need to be in a vehicle to lock the doors");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}

CMD:unlockcar(playerid,params[]) {
	#pragma unused params
    if(PlayerInfo[ playerid ][Level] >= 0) {
	    if(IsPlayerInAnyVehicle(playerid)) {
		 	for(new i = 0; i < MAX_PLAYERS; i++) SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,false,false);
			CMDMessageToAdmins(playerid,"UNLOCKCAR");
			PlayerInfo[ playerid ][DoorsLocked] = 0;
			new string[128]; format(string,sizeof(string),"Unlocked vehicle.", pName(playerid));
			return SendClientMessageToAll(blue,string);
		} else return SendClientMessage(playerid,red,"ERROR: You need to be in a vehicle to lock the doors");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
CMD:eject(playerid,params[]) {
	if(PlayerInfo[ playerid ][Level] >= 4) {
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /eject [ playerid ]");
		new player1 = strval(params), string[128], Float:x, Float:y, Float:z;
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[ playerid ][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			if(IsPlayerInAnyVehicle(player1)) {
		       	CMDMessageToAdmins(playerid,"EJECT");
				if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has ejected you from your vehicle", pName(playerid) ); SendClientMessage(player1,blue,string); }
				format(string,sizeof(string),"You have ejected \"%s\" from their vehicle", pName(player1)); SendClientMessage(playerid,blue,string);
    		   	GetPlayerPos(player1,x,y,z);
				return SetPlayerPos(player1,x,y,z+3);
			} else return SendClientMessage(playerid,red,"ERROR: Player is not in a vehicle");
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.