SA-MP Forums Archive
[QUESTION] What's Wrong With This Command? - 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: [QUESTION] What's Wrong With This Command? (/showthread.php?tid=361323)



[QUESTION] What's Wrong With This Command? - Anters14 - 20.07.2012

Well I Tried Scripting a Command For PD Called /pow Which Sends a Message Saying You See Flashing Lights And Sirens Using Cmd_m. I Get An Error From It. Also Can Someone Help Me Find An ID Of a Red Flashing Light, Thanks!

Here's The CMD:
Код:
CMD:pow(playerid,params[])
{
    if(IsACop(playerid))
	return cmd_m(playerid, "======YOU SEE FLASHING LIGHTS AND SIRENS======");
}
Here's The Warning;
Код:
warning 209: function "cmd_pow" should return a value



Re: [QUESTION] What's Wrong With This Command? - Rudy_ - 20.07.2012

pawn Код:
CMD:pow(playerid,params[])
{
    if(IsACop(playerid))
    {
        SendClientMessage(playerid,-1, "======YOU SEE FLASHING LIGHTS AND SIRENS======");
    }
    return 1;
}
This forum requires that you wait 120 seconds between posts. Please try again in 14 seconds.


Re: [QUESTION] What's Wrong With This Command? - Anters14 - 20.07.2012

Will This Return With The CMD_M Becuase People Around Should Be Able To See It Now Just The Player Who Typed It? So Really it Works Like /m. But It Saves Police Having To Type It, I Hope You Know What I Mean


Re: [QUESTION] What's Wrong With This Command? - Kindred - 20.07.2012

pawn Код:
CMD:pow(playerid,params[])
{
    if(IsACop(playerid))
    return cmd_m(playerid, "======YOU SEE FLASHING LIGHTS AND SIRENS======");
    return 1;
}
You forgot to return a value if the player WASN'T a cop.


Re: [QUESTION] What's Wrong With This Command? - Anters14 - 20.07.2012

Quote:
Originally Posted by Kindred
Посмотреть сообщение
pawn Код:
CMD:pow(playerid,params[])
{
    if(IsACop(playerid))
    return cmd_m(playerid, "======YOU SEE FLASHING LIGHTS AND SIRENS======");
    return 1;
}
You forgot to return a value if the player WASN'T a cop.
Thanks Very Much That Worked. I Was wondering If You Could Help Me With Something Else, Do You Know Why This Command Sends a Message To The Whole Server If No ID Is Entered?

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; // Always need to return 1 on commands, or you'll see "SERVER: Unknown Command".
}