What Did I Do Wrong?
#1

I don't know what I did wrong! I was following a tutorial then started writing other commands based on the info from the tutorial, I compiled and all this happened:
http://justpaste.it/120h

Help with this code would be so much appreciated :\
If you could fix the code I made and paste it here I will +REP you
Reply
#2

If you've included zcmd why are you using strcmp?
Reply
#3

I belive this should work

pawn Код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "help", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED,"(INFO) Welcome to the /help command.");
        SendClientMessage(playerid, COLOR_RED,"Here is a list of commands:");
        SendClientMessage(playerid, COLOR_RED,"/AFK, /BRB, /Back, /V, /Code2, /Grapple, /LaserOn, /LaserOff, /VehicleControl");
        return 1;
    }
    if (strcmp(cmdtext, "/AFK", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /AFK (Makes you AFK. You cannot get killed or injured while AFK.)");
        return 1;
    }
    if (strcmp(cmdtext, "/BRB", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /BRB (Basically the same as /AFK but it says you will be right back on the chat.");
        return 1;
    }
    if (strcmp(cmdtext, "/Back", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: Back (Turns /AFK or /BRB off an announces you are back.)");
        return 1;
    }
    if (strcmp(cmdtext, "/V", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /V (Brings up a dialog to spawn cars.)");
        return 1;
    }
    if (strcmp(cmdtext, "/Code2", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /Code2 (Turns on the just the emergency lights in any emergency vehicle.)");
        return 1;
    }
    if (strcmp(cmdtext, "/Grapple", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /Grapple (Makes it so you can use the silenced 9mm like a grapple hook shooter.)");
        return 1;
    }
    if (strcmp(cmdtext, "/LaserOn", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /LaserOn (Turns on a laser sight for certain weapons such as 9mm, M4, AK47, etc.)");
        return 1;
    }
    if (strcmp(cmdtext, "/LaserOff", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /LaserOff (Turns off the laser sight for weapons.)");
        return 1;
    }
    if (strcmp(cmdtext, "/VehicleControl", true, 5) == 0)
    {
       SendClientMessage(playerid, COLOR_RED, "USAGE: /VehicleControl (Displays the vehicle control commands.)");
       return 1;
    }
return 1;
}
Reply
#4

Thanks a ton! I didn't know it would be so simple lol
Reply
#5

OK so when I try to use the /help command in my server it just doesn't say anything. Not "UNKNOWN COMMAND" or anything! The FS loads successfully so idk..
Reply
#6

I accidently removed an "/" so here it is!

pawn Код:
#include <a_samp>
#define COLOR_RED 0xAA3333AA
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/help", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED,"(INFO) Welcome to the /help command.");
        SendClientMessage(playerid, COLOR_RED,"Here is a list of commands:");
        SendClientMessage(playerid, COLOR_RED,"/AFK, /BRB, /Back, /V, /Code2, /Grapple, /LaserOn, /LaserOff, /VehicleControl");
        return 1;
    }
    if (strcmp(cmdtext, "/AFK", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /AFK (Makes you AFK. You cannot get killed or injured while AFK.)");
        return 1;
    }
    if (strcmp(cmdtext, "/BRB", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /BRB (Basically the same as /AFK but it says you will be right back on the chat.");
        return 1;
    }
    if (strcmp(cmdtext, "/Back", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: Back (Turns /AFK or /BRB off an announces you are back.)");
        return 1;
    }
    if (strcmp(cmdtext, "/V", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /V (Brings up a dialog to spawn cars.)");
        return 1;
    }
    if (strcmp(cmdtext, "/Code2", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /Code2 (Turns on the just the emergency lights in any emergency vehicle.)");
        return 1;
    }
    if (strcmp(cmdtext, "/Grapple", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /Grapple (Makes it so you can use the silenced 9mm like a grapple hook shooter.)");
        return 1;
    }
    if (strcmp(cmdtext, "/LaserOn", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /LaserOn (Turns on a laser sight for certain weapons such as 9mm, M4, AK47, etc.)");
        return 1;
    }
    if (strcmp(cmdtext, "/LaserOff", true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "USAGE: /LaserOff (Turns off the laser sight for weapons.)");
        return 1;
    }
    if (strcmp(cmdtext, "/VehicleControl", true, 5) == 0)
    {
       SendClientMessage(playerid, COLOR_RED, "USAGE: /VehicleControl (Displays the vehicle control commands.)");
       return 1;
    }
return 1;
}
Reply
#7

Oh ok, thank you very much! I'm guessing some of the "{" indentations were wrong? This is my very first time scripting with Pawno
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)