[HELP] Bug In Command
#1

Okay So I Have This Command For LEO's In My Server. But If They Don't Enter An ID When Typing The Command Everyone Else In The Server Gets The Message :S. For Example /rights [1] Would Send The Message To ID 1 but If They Type /rights Then Click Enter Everyone In The Server But Them Gets It.

Here's The Command;
pawn Код:
CMD:rights(playerid, params[])
{
    new id = strval(params);
    if(IsACop(playerid))
    if(!IsPlayerConnected(id))SendClientMessage(playerid, 0xFF0000FF, "Invalid Player ID");
    else
    {
        SendClientMessage(id, COLOR_RED, "You Have The Right To Remain Silent.");
        SendClientMessage(id, COLOR_RED, "Anything You Say Can Be Used Against You In a Court Of Law.");
        SendClientMessage(id, COLOR_RED, "You Have The Right To An Attorney Present Now And During Any Further Questioning");
        SendClientMessage(id, COLOR_RED, "If You Can Not Afford An Attorney, One Will Be Appointed To You Free Of Charge If You Wish");
        SendClientMessage(id, COLOR_RED, "Do You Understand Your Rights As They Have Been Read To You?((Say Yes Or No To The Officer))");
    }
    return 1;
}
Reply
#2

try this

pawn Код:
CMD:rights(playerid, params[])
{
    new id;
    if(IsACop(playerid))
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "Usage: /rights [id]");
    else
    {
        SendClientMessage(id, COLOR_RED, "You Have The Right To Remain Silent.");
        SendClientMessage(id, COLOR_RED, "Anything You Say Can Be Used Against You In a Court Of Law.");
        SendClientMessage(id, COLOR_RED, "You Have The Right To An Attorney Present Now And During Any Further Questioning");
        SendClientMessage(id, COLOR_RED, "If You Can Not Afford An Attorney, One Will Be Appointed To You Free Of Charge If You Wish");
        SendClientMessage(id, COLOR_RED, "Do You Understand Your Rights As They Have Been Read To You?((Say Yes Or No To The Officer))");
    }
    return 1;
}
Reply
#3

use
pawn Код:
if(isnull(params)) return SendClientMessage(playerid,-1,"Usage /Rights [id]");
Edit: Late -.-
Reply
#4

Yeah I was always hating the 120 seconds wait too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)