SA-MP Forums Archive
[ERROR]With cmd's - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [ERROR]With cmd's (/showthread.php?tid=125989)



[ERROR]With cmd's - JakesRolePlay - 06.02.2010

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;
    }
}



Re: [ERROR]With cmd's - mansonh - 06.02.2010

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;
}