[ERROR]With cmd's
#1

Hello, well I tried to add a /help and /rules command and I get:
pawn Код:
C:\Program Files (x86)\Rockstar Games\SA-MP Server 2\gamemodes\CMFS.pwn(86) : warning 209: function "OnPlayerCommandText" should return a value
C:\Program Files (x86)\Rockstar Games\SA-MP Server 2\gamemodes\CMFS.pwn(87) : error 055: start of function body without function header
C:\Program Files (x86)\Rockstar Games\SA-MP Server 2\gamemodes\CMFS.pwn(88) : error 010: invalid function or declaration
C:\Program Files (x86)\Rockstar Games\SA-MP Server 2\gamemodes\CMFS.pwn(96) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
And here is my cmd's:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN, "------CMFS Help--------");
    SendClientMessage(playerid, COLOR_GREEN, "We are a server that is in progress");
    SendClientMessage(playerid, COLOR_GREEN, "We use fsdebug for now...");
    SendClientMessage(playerid, COLOR_GREEN, "We hope to get a full script in a week to a month");
    SendClientMessage(playerid, COLOR_GREEN, "Just bare with us and have fun");
    SendClientMessage(playerid, COLOR_GREEN, "[CMDS]: /v /w /w2 /t /rules some others to....");
    SendClientMessage(playerid, COLOR_GREEN, "You can ask a admin (If any) for more help and rules.");
        return 1;
    }
}
And right after that:
pawn Код:
{
    if (strcmp("/rules", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN, "-------CMFS Rules--------");
    SendClientMessage(playerid, COLOR_GREEN, "We don't really care what you do,");
    SendClientMessage(playerid, COLOR_GREEN, "Just don't DM, you can have some fights with people,");
    SendClientMessage(playerid, COLOR_GREEN, "And kill them but don't kill them otherwise.");
    SendClientMessage(playerid, COLOR_GREEN, "And don't over spawn cars.");
    SendClientMessage(playerid, COLOR_GREEN, "You can ask a admin (If any) for more help and rules.");
        return 1;
    }
}
Put together:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN, "------CMFS Help--------");
    SendClientMessage(playerid, COLOR_GREEN, "We are a server that is in progress");
    SendClientMessage(playerid, COLOR_GREEN, "We use fsdebug for now...");
    SendClientMessage(playerid, COLOR_GREEN, "We hope to get a full script in a week to a month");
    SendClientMessage(playerid, COLOR_GREEN, "Just bare with us and have fun");
    SendClientMessage(playerid, COLOR_GREEN, "[CMDS]: /v /w /w2 /t /rules some others to....");
    SendClientMessage(playerid, COLOR_GREEN, "You can ask a admin (If any) for more help and rules.");
        return 1;
    }
}
{
    if (strcmp("/rules", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN, "-------CMFS Rules--------");
    SendClientMessage(playerid, COLOR_GREEN, "We don't really care what you do,");
    SendClientMessage(playerid, COLOR_GREEN, "Just don't DM, you can have some fights with people,");
    SendClientMessage(playerid, COLOR_GREEN, "And kill them but don't kill them otherwise.");
    SendClientMessage(playerid, COLOR_GREEN, "And don't over spawn cars.");
    SendClientMessage(playerid, COLOR_GREEN, "You can ask a admin (If any) for more help and rules.");
        return 1;
    }
}
Reply
#2

http://forum.sa-mp.com/index.php?topic=2750.0

Brackets!

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/help", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN, "------CMFS Help--------");
    SendClientMessage(playerid, COLOR_GREEN, "We are a server that is in progress");
    SendClientMessage(playerid, COLOR_GREEN, "We use fsdebug for now...");
    SendClientMessage(playerid, COLOR_GREEN, "We hope to get a full script in a week to a month");
    SendClientMessage(playerid, COLOR_GREEN, "Just bare with us and have fun");
    SendClientMessage(playerid, COLOR_GREEN, "[CMDS]: /v /w /w2 /t /rules some others to....");
    SendClientMessage(playerid, COLOR_GREEN, "You can ask a admin (If any) for more help and rules.");
        return 1;
    }
    if (strcmp("/rules", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_GREEN, "-------CMFS Rules--------");
    SendClientMessage(playerid, COLOR_GREEN, "We don't really care what you do,");
    SendClientMessage(playerid, COLOR_GREEN, "Just don't DM, you can have some fights with people,");
    SendClientMessage(playerid, COLOR_GREEN, "And kill them but don't kill them otherwise.");
    SendClientMessage(playerid, COLOR_GREEN, "And don't over spawn cars.");
    SendClientMessage(playerid, COLOR_GREEN, "You can ask a admin (If any) for more help and rules.");
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)