Jetpack ZCMD
#1

Hello guys, can you please tell me what's wrong with this zcmd? How do i show someone a message that the cmd has been typed?

http://pastebin.com/h32AF51v
Reply
#2

Use like Abroadcast(playerid, COLOR_DARKRED, string);

or a chat that only admins can see.
Reply
#3

Like this!?

Quote:

CMD:jetpack(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "u", playerid));
format(string, sizeof(string), "AdmCmd: %s has spawned a Jetpack.", sendername);
Abroadcast(playerid, COLOR_DARKRED, string);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USE JETPACK);
return 1;
}

Reply
#4

Quote:
Originally Posted by Fiore
Посмотреть сообщение
Like this!?
Yes, but you will need to create a stock, something like this

Код:
stock Abroadcast(color, admlvl, string[])
{
	foreach(Player, i)
	{
		if(IsPlayerLoggedIn(i) && PlayerInfo[i][pAdmin] >= admlvl)
		{
		    SendClientMessage(i, color, string);
		}
	}
	return 1;
}
Reply
#5

pawn Код:
CMD:jetpack(playerid, params[])
{
        new string[128];
        if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(sscanf(params, "u", playerid));
        format(string, sizeof(string), "AdmCmd %s has spawned a Jetpack.", sendername);
        ABroadCast(COLOR_DARKRED, string);
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
        return 1;
}

stock ABroadCast(color,string[],level)
{
    foreach(Player, i)
    {
        if (PlayerInfo[i][pAdmin] >= level)
        {
            SendClientMessageEx(i, color, string);
        }
    }
    return 1;
}
Reply
#6

Thank you guys
Reply
#7

Quote:
Originally Posted by Fiore
Посмотреть сообщение
Thank you guys
Glad to help you out - if you require further help, pop me a PM or Visitor Message and I'll help you out
Reply
#8

Yours playerid is the player which type a command but in if statement with sscanf function you are setting playerid to your target player, that's why you were not receive any message. You should then declare an integer and then put the name of it in sscanf.

I know it is fixed but its not needed to create another function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)