SA-MP Forums Archive
Command typed, nothing happen - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command typed, nothing happen (/showthread.php?tid=474593)



Command typed, nothing happen - Blackazur - 08.11.2013

Why dont happen anything if i type this command?

Код:
CMD:report(playerid,params[])
{
	if(GetPVarInt(playerid,"adminlevel") < 1) return Text_Send(playerid,"Nincs jogosultsбgod a parancs hasznбlatбhoz!",""CT_INDIANRED"You are not allowed to use this command.");
	new grund[148], id, givid, giveplayer[MAX_PLAYER_NAME];
    if(sscanf(params, "k<pon>", givid,grund)) { Text_2Send(playerid,"Hasznбlat: %s","Usage: %s","/akill (PLAYER) [reason]"); return 1; }
	if(givid == INVALID_PLAYER_ID) return Text_Send(playerid,"Йrvйnytelen jбtйkos!","Invalid player!");
	GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(givid, giveplayer, sizeof(giveplayer));
   	format(astring,sizeof(astring),"{FFFFFF}[Jelentйs] {FF00EA}%s(%d) {FFFFFF}бltal jelentett: {99FF99}%s(%d) {FFFFFF}||| {FFFF99}[Йsszeru: %s]","{FFFFFF}[REPORT] {FF00EA}%s(%d) {FFFFFF}reported by: {99FF99}%s(%d) {FFFFFF}||| {FFFF99}[Reason: %s]",givid,id,GetName(playerid),playerid,grund);
	SendAdminMessage(1, COLOR_RED, astring);
	Text_Send(playerid,COLOR_RED_"A jelentйst elkьldtйk az online adminok!","Your report has been sent to the online admins!");
	return 1;
}



Re: Command typed, nothing happen - DanishHaq - 08.11.2013

pawn Код:
if(sscanf(params, "k<pon>", givid,grund))
to

pawn Код:
if(sscanf(params, "us[148]", givid, grund))
Try that.


Re: Command typed, nothing happen - AnonScripter - 08.11.2013

pawn Код:
stock GetName(playerid)
{
    new
    name[24];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}

forward SendClientMessageToAllAdmins(msg[]);
public SendClientMessageToAllAdmins(msg[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsPlayerAdmin(i))
        {
            SendClientMessage(i,COLOR_YELLOW,msg);
        }
    }
}

CMD:report(playerid, params[])
{
    new string[128], reason[50],targetid;
    if(sscanf(params, "us[50]", targetid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "/report [playerid/name] [reason]");
    if(targetid == playerid) return SendClientMessage(playerid,COLOR_WHITE,"You cannot report yourself");
    if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected");
    format(string, sizeof(string), "%s(%d) has reported %s(%d) - Reason: %s", GetName(playerid), playerid, GetName(targetid), targetid, reason);
    SendClientMessageToAllAdmins(string);
    SendClientMessage(playerid, COLOR_GREEN, "report sent successfully to an online admin.");
    return 1;
}



Re: Command typed, nothing happen - Zex Tan - 08.11.2013

He did the correct way of using k<pon> or maybe there's something wrong with your SSCANF: pon and possibilitywithout strings.