open.mp forum
[Pawn] Command does not work in-game - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] Command does not work in-game (/showthread.php?tid=2971)



Command does not work in-game - PANZEHIR_ - 2024-11-23

Hello, i made a simple /explode <playername/playerid> <explosion type> command.
I dont get any compile errors, but the explosion type does not work in-game, so i can not explode other player with different explosion types... i dont understand why.

Quote:CMD:explode(playerid, params[])
{
new string[128], bombid, Float:x, Float:y, Float:z, Float:type;
if(sscanf(params, "ui", bombid, type)) SendClientMessage(playerid, 0xff0004AA, "Usage: /explode <playername/playerid> <explosion type>");
else if(!IsPlayerConnected(bombid)) SendClientMessage(playerid, 0xff0004AA, "ERROR: This player is not connected.");
else
{
new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id;
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
GetPlayerName(id, targetname, MAX_PLAYER_NAME);
GetPlayerPos(bombid, x, y, z);
CreateExplosion(x, y, z, bombid, 10.00);
format(string, 128, "* You have exploded %s (ID:%d)", name, playerid);
SendClientMessage(playerid, 0x43ff0fAA, string);
format(string, 128, "* %s (ID:%d) exploded %s (ID:%d) with explosion type %i", name, playerid, targetname, id, type);
SendClientMessageToAll(0xffea00AA, string);

}
return 1;
}