explode cmd help
#1

Hi,i've this cmd

Код:
dcmd_explode(playerid, params[])
{
	new id;
	if(sscanf(params, "u", id))
	    return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /explode [nick/id]");
	if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id))
	    return SendClientMessage(playerid, COLOR_RED, "ERROR: That player is not connected!");
	new Float:Pos[3];
	GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
	CreateExplosion(Pos[0], Pos[1], Pos[2], 0, 10.0);
	return 1;
}
I need to add the message to all.

Ex: Admin ADMINAME has exploded PLAYERNAME

How?
Reply
#2

https://sampwiki.blast.hk/wiki/SendClientMessageToAll
Reply
#3

Код:
dcmd_explode(playerid, params[])
{
    new string[256];
	new id;
	if(sscanf(params, "u", id))
	    return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /explode [nick/id]");
	if(id == INVALID_PLAYER_ID || !IsPlayerConnected(id))
	    return SendClientMessage(playerid, COLOR_RED, "ERROR: That player is not connected!");
	new Float:Pos[3];
	GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
	CreateExplosion(Pos[0], Pos[1], Pos[2], 0, 10.0);
 	format(string, sizeof(string), "Admin: %s has exploded %s", playerid,id);
	SendClientMessageToAll(COLOR_RED, string);
	return 1;
}
Try this!
Reply
#4

Quote:
Originally Posted by akis_tze
Посмотреть сообщение
pawn Код:
new string[256];
Why use 256 cells?
Reply
#5

Thanks akis_tze but that gives only like:

Admin 59 EXPLODED 5

(EXAMPLES IDS)

..?
Reply
#6

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
Thanks akis_tze but that gives only like:

Admin 59 EXPLODED 5

(EXAMPLES IDS)

..?
pawn Код:
dcmd_explode(playerid, params[])
{
    new string[100];
    new player[MAX_PLAYER_NAME], new name[MAX_PLAYER_NAME];
    GetPlayerName(player,sizeof(player));
    GetPlayerName(name,sizeof(name));
    if(sscanf(params, "u", player))
        return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /explode [nick]");
    if(name == INVALID_PLAYER_ID || !IsPlayerConnected(name))
        return SendClientMessage(playerid, COLOR_RED, "ERROR: That player is not connected!");
    new Float:Pos[3];
    GetPlayerPos(name, Pos[0], Pos[1], Pos[2]);
    CreateExplosion(Pos[0], Pos[1], Pos[2], 0, 10.0);
    format(string, sizeof(string), "Admin: %s has exploded %s", player,name);
    SendClientMessageToAll(COLOR_RED, string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)