Help with zcmd
#5

Here is the freeze command with Zcmd and Sscanf, try it

First define the colors :-

Код:
#define Green 0x33AA33AA
#define Yellow 0xFFFF00AA
Now for the command

Код:
CMD:freeze(playerid, params[])
{
    new targetid, string[128], aname[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME];
	if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid, Yellow, "You must be an admin to use this cmd!");
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, Green, "Correct Usage: /freeze [PlayerID]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, Yellow, "This player is not connected to the server");
 	if(PlayerInfo[targetid][Adminlevel] < 1) return SendClientMessage(playerid, Red, "You can't freeze another admin");
	GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
	GetPlayerName(targetid, tname, MAX_PLAYER_NAME);
	format(string, sizeof(string), "%s has frozen %s", aname, tname);
	TogglePlayerControllable(targetid, 0);
	SendClientMessageToAll(Yellow, string);
	GameTextForPlayer(targetid, "~r~Freezed!", 2000, 2);
	return 1;
}
Unfreeze command :-

Код:
CMD:unfreeze(playerid, params[])
{
    new targetid, string[128], aname[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME];
	if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid, Yellow, "You must be an admin to use this cmd!");
	if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, Green, "Correct Usage: /unfreeze [PlayerID]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, Yellow, "This player is not connected to the server");
	GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
	GetPlayerName(targetid, tname, MAX_PLAYER_NAME);
	format(string, sizeof(string), "%s has unfrozen %s", aname, tname);
	TogglePlayerControllable(targetid, 1);
	SendClientMessageToAll(Yellow, string);
	GameTextForPlayer(targetid, "~g~Unfreezed", 2000, 2);
	return 1;
}
Sorry if I bumped, I hope it works with you
Reply


Messages In This Thread
Help with zcmd - by Benzke - 18.08.2012, 08:23
Re : Help with zcmd - by ricardo178 - 18.08.2012, 08:30
Re: Help with zcmd - by Benzke - 18.08.2012, 08:31
Re : Help with zcmd - by ricardo178 - 18.08.2012, 09:20
Re: Help with zcmd - by gtakillerIV - 19.08.2012, 22:30
Re: Help with zcmd - by Shetch - 20.08.2012, 00:56

Forum Jump:


Users browsing this thread: 2 Guest(s)