SA-MP Forums Archive
[Need Help] Command not working in-game - 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: [Need Help] Command not working in-game (/showthread.php?tid=303537)



[Need Help] Command not working in-game - andrew2695 - 14.12.2011

Hi can anyone tell me wats wrong with this script? I compile perfectly but in-game nothing working :/

Код:
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Events System");
	print("--------------------------------------\n");
	return 1;
}
new Events;
new Float:Event[3];

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmd, "/startevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
             if(IsPlayerAdmin(playerid)) && (!EventStarted))
            {
                EventStarted = 1;
                EventLocked = 0;
                GetPlayerPos(playerid,ex,ey,ez);
                GetPlayerVirtualWorld(playerid);
                GetPlayerInterior(playerid);
                BroadCast(COLOR_LIGHTBLUE, "** Notice: An Event has started, use /joinevent.");
            }
            else if (PlayerInfo[playerid][pAdmin] >= 5 && (EventStarted))
            {
                EventStarted = 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/joinevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(EventStarted == 0)
            {
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, " ** An Event has not Started.");
                  return 1;
            }
            else if(EventLocked == 1)
            {
                  SendClientMessage(playerid, COLOR_RED, "** The event is locked.");
                  return 1;
            }
            new EJoin = strval(tmp);
            new vw = GetPlayerVirtualWorld(playerid);
            SetPlayerPos(playerid,ex,ey,ez);
            SetPlayerVirtualWorld(playerid,vw);
            SetPlayerInterior(playerid,EventInfo[EJoin][EInterior]);
            PlayerInfo[playerid][pInt] = EventInfo[EJoin][EInterior];
        }
        return 1;
    }
    if(strcmp(cmd, "/lockevent", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
        	if(IsPlayerAdmin(playerid))
            {
                EventLocked = 1;
                BroadCast(COLOR_YELLOW, "** Notice: The event has been locked by a Admin **");
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
            }
        }
        return 1;
    }
#endif



Re: [Need Help] Command not working in-game - suhrab_mujeeb - 14.12.2011

Change
pawn Код:
if(strcmp(cmd, "/startevent", true) == 0)
To
pawn Код:
if(strcmp(cmdtext, "/startevent", true) == 0)
And same goes with all the other commands.


Re: [Need Help] Command not working in-game - andrew2695 - 14.12.2011

I did but its same, Nothing happens in-game (Logged into rcon)


Re: [Need Help] Command not working in-game - suhrab_mujeeb - 14.12.2011

Where is EventStarted defined? Does the command say unknown command or something like that?


Re: [Need Help] Command not working in-game - andrew2695 - 14.12.2011

I don't have it defined, maybe its the prob, How can i get it defined because I took this script from sa-mp forum


Re: [Need Help] Command not working in-game - suhrab_mujeeb - 14.12.2011

Can you post the link from you downloaded it?


Re: [Need Help] Command not working in-game - andrew2695 - 14.12.2011

there is https://sampforum.blast.hk/showthread.php?tid=265796


Re: [Need Help] Command not working in-game - RoboN1X - 14.12.2011

check your script:
pawn Код:
#if defined FILTERSCRIPT
and at the end of script:
pawn Код:
#endif
You need to add this: (or remove the both code above)
pawn Код:
#define FILTERSCRIPT
if you already have that code(above) in your script, maybe you just have comment like this (double slash):
pawn Код:
//
just delete them

NOTE: when you added that(or remove the comment), you may that you will get some errors because some variables/functions are not defined