SA-MP Forums Archive
[HELP] 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: [HELP] Command (/showthread.php?tid=517813)



[HELP] Command - monster010 - 06.06.2014

I when writing /neon, server unknow command?

pawn Код:
if(strcmp(cmdtext, "/neon", true) == 0)
    {
        if(PlayerToPoint(25.0,playerid,207.5627,-103.7291,1005.2578))
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                {
                    SendClientMessage(playerid, COLOR_GREY, "* Tu nu esti sofer. Comanda anulata");
                    return 1;
                }
                ShowPlayerDialog(playerid, NEON, DIALOG_STYLE_LIST, "Culori Neoane","Albastru\nVerde\nGalben\nAlb\nRoz\nScoate neonul","Adauga","Inchide");
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "* Nu esti intr-o masina. Comanda anulata");
            }
            return 1;
        }
    }



Re: [HELP] Command - MattTucker - 06.06.2014

What is PlayerToPoint? Your own created func/stock? I believe it's IsPlayerInRangeOfPoint?..

PS:Change
pawn Код:
if(strcmp(cmdtext, "/neon", true) == 0)
To
pawn Код:
if(strcmp("/neon",cmdtext, true,5) == 0)

EDIT: if you meant IsPlayerInRangeOfPoint then edit the parameters for PlayerToPoint
from
pawn Код:
if(PlayerToPoint(25.0,playerid,207.5627,-103.7291,1005.2578))
to
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,25.0,207.5627,-103.7291,1005.2578))



Re: [HELP] Command - erminpr0 - 06.06.2014

'Unknown command' appears when OnPlayerCommandText returns false. To avoid message you should add
pawn Код:
return 1;
Код:
if(strcmp(cmdtext, "/neon", true) == 0)
    {
        if(PlayerToPoint(25.0,playerid,207.5627,-103.7291,1005.2578))
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
                {
                    SendClientMessage(playerid, COLOR_GREY, "* Tu nu esti sofer. Comanda anulata");
                    return 1;
                }
                ShowPlayerDialog(playerid, NEON, DIALOG_STYLE_LIST, "Culori Neoane","Albastru\nVerde\nGalben\nAlb\nRoz\nScoate neonul","Adauga","Inchide");
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "* Nu esti intr-o masina. Comanda anulata");
            }
            return 1;
        }
        return 1;
    }
Do you see it?

RED (Returning true only if PlayerToPoint code returns true, in this case)
GREEN (Callback will return true so server will know if it was successfull)


Re: [HELP] Command - monster010 - 07.06.2014

Oooh!...I don;t see this ). Thanks !