/mute isnt working :O ?
#1

Код:
dcmd_mute(playerid,params[])
{
	new giveplayerid;
	if(pInfo[playerid][Adminlvl] < Moderator) return SendClientMessage(playerid,COLOR_RED,"You Have To Be Admin Level 1 To Use This Command");
	if(sscanf(params,"u",giveplayerid)) return SendClientMessage(playerid,COLOR_RED,"Usage: /mute [playerid]");
	if(giveplayerid == playerid) return SendClientMessage(playerid,COLOR_RED,"You Can't Mute Urself");
       	if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"User Doesn't Exist");
	if(pInfo[giveplayerid][Muted] == 1) return SendClientMessage(playerid,COLOR_RED,"Player Already Muted");
	new pid[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME];
	GetPlayerName(giveplayerid,pid,MAX_PLAYER_NAME);
	GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
	new string[128]; format(string,128,"You Muted %s",pid);
	SendClientMessage(playerid,COLOR_YELLOW,string);
	format(string,128,"You've Been Muted By %s",pName);
	SendClientMessage(giveplayerid,COLOR_RED,string);
	pInfo[giveplayerid][Muted] = 1;
	return 1;
}
no errors but when i /mute [anything] name or invalid id it just mutes me and when i added "if(giveplayerid == playerid) return ....." it keep saying u can't mute urself and i am not inserting my id or name :S what's wrong?
Reply
#2

If you are playerid 0 and write just "/mute" with no id, the variable 'giveplayerid' will also be zero. That's why you get the message.
Reply
#3

I am yet to understand why people use dcmd and why people use sscanf for one parameter
pawn Код:
dcmd_mute(playerid,params[])
{
    new giveplayerid;
    if(pInfo[playerid][Adminlvl] < Moderator) return SendClientMessage(playerid,COLOR_RED,"You Have To Be Admin Level 1 To Use This Command");
        giveplayerid = strval( params );
    if(giveplayerid == playerid) return SendClientMessage(playerid,COLOR_RED,"You Can't Mute Urself");
    if(pInfo[giveplayerid][Muted] == 1) return SendClientMessage(playerid,COLOR_RED,"Player Already Muted");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_RED,"User Doesn't Exist");
    new pid[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME];
    GetPlayerName(giveplayerid,pid,MAX_PLAYER_NAME);
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    new string[128]; format(string,128,"You Muted %s",pid);
    SendClientMessage(playerid,COLOR_YELLOW,string);
    format(string,128,"You've Been Muted By %s",pName);
    SendClientMessage(giveplayerid,COLOR_RED,string);
    pInfo[giveplayerid][Muted] = 1;
    return 1;
}
Reply
#4

because sscanf give u the ability to do /mute [playername] not just /mute [playerid] and btw command is working like a charm but if i like typed : /mute grim it says "u can't mute urself"

Код:
dcmd_mute(playerid,params[])
{
    new giveplayerid;
    giveplayerid = strval( params );
    if(pInfo[playerid][Adminlvl] < Moderator) return SendClientMessage(playerid,COLOR_RED,"You Have To Be Admin Level 1 To Use This Command");
    if(!strlen(params)) return SendClientMessage(playerid,COLOR_RED,"Usage: /mute [playerid]");
    if(giveplayerid == playerid) return SendClientMessage(playerid,COLOR_RED,"You Can't Mute Urself");
    if(pInfo[giveplayerid][Muted] == 1) return SendClientMessage(playerid,COLOR_RED,"Player Already Muted");
    if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,COLOR_RED,"User Doesn't Exist");
    new pid[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME];
    GetPlayerName(giveplayerid,pid,MAX_PLAYER_NAME);
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    new string[128]; format(string,128,"You Muted %s",pid);
    SendClientMessage(playerid,COLOR_YELLOW,string);
    format(string,128,"You've Been Muted By %s",pName);
    SendClientMessage(giveplayerid,COLOR_RED,string);
    pInfo[giveplayerid][Muted] = 1;
    return 1;
}
Reply
#5

Bumpy
Reply
#6

Well
pawn Код:
#define isnull(%1) \
            ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
pawn Код:
dcmd_mute(playerid,params[])
{
    new giveplayerid;
    if(pInfo[playerid][Adminlvl] < Moderator) return SendClientMessage(playerid,COLOR_RED,"You Have To Be Admin Level 1 To Use This Command");
        if(isnull(params)) return SendClientMessage(playerid, COLOR_RED,"Usage: /mute [playerid]");
    if(giveplayerid == playerid) return SendClientMessage(playerid,COLOR_RED,"You Can't Mute Urself");
        if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"User Doesn't Exist");
    if(pInfo[giveplayerid][Muted] == 1) return SendClientMessage(playerid,COLOR_RED,"Player Already Muted");
    new pid[MAX_PLAYER_NAME],pName[MAX_PLAYER_NAME];
    GetPlayerName(giveplayerid,pid,MAX_PLAYER_NAME);
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    new string[128]; format(string,128,"You Muted %s",pid);
    SendClientMessage(playerid,COLOR_YELLOW,string);
    format(string,128,"You've Been Muted By %s",pName);
    SendClientMessage(giveplayerid,COLOR_RED,string);
    pInfo[giveplayerid][Muted] = 1;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)