SA-MP Forums Archive
1 or 2 CMDS in same script. HELP. - 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: 1 or 2 CMDS in same script. HELP. (/showthread.php?tid=73528)



1 or 2 CMDS in same script. HELP. - Simmeey - 15.04.2009

#include <a_samp>
#include <a_players>

#define FILTERSCRIPT

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/helpinfo", true) == 0)
{
// Send a message to everyone.
SendClientMessageToAll(0xDEEE20FF, "This is just like a RP drift server.");
SendClientMessageToAll(0xDEEE20FF, "You pick a car and drift.");
SendClientMessageToAll(0xDEEE20FF, "No teleports.");
SendClientMessageToAll(0xDEEE20FF, "Aight?.");
SendClientMessageToAll(0xDEEE20FF, "If you want night, type /night.");
SendClientMessageToAll(0xDEEE20FF, "Respect admins, Teleports might come when i got time.");

return 1;
}
return 0;
}

{
if (strcmp(cmdtext, "/cmds", true) == 0)
{
// Send a message to everyone.
SendClientMessageToAll(0xDEEE20FF, "TIME CMDS: /night /day ");
SendClientMessageToAll(0xDEEE20FF, "DRIFT CMDS: /drift1-19");
SendClientMessageToAll(0xDEEE20FF, "OTHER CMDS: /vfix /vflip /v color (ID)(ID).");

return 1;
}
return 0;
}


I get those errors:
C:\Documents and Settings\SandmaN\Skrivbord\Viper\filterscripts\LOL .pwn(23) : error 055: start of function body without function header
C:\Documents and Settings\SandmaN\Skrivbord\Viper\filterscripts\LOL .pwn(24) : error 010: invalid function or declaration
C:\Documents and Settings\SandmaN\Skrivbord\Viper\filterscripts\LOL .pwn(27) : error 021: symbol already defined: "SendClientMessageToAll"
C:\Documents and Settings\SandmaN\Skrivbord\Viper\filterscripts\LOL .pwn(31) : error 010: invalid function or declaration
C:\Documents and Settings\SandmaN\Skrivbord\Viper\filterscripts\LOL .pwn(33) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.


What do i do wrong.. Wiki samp is down. Help please.
thanks



Re: 1 or 2 CMDS in same script. HELP. - Weirdosport - 15.04.2009

Better yet, let me post the entire thing!

pawn Код:
#include <a_samp>
#include <a_players>

#define FILTERSCRIPT

public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp(cmdtext, "/helpinfo", true) == 0)
  {
    // Send a message to everyone.
    SendClientMessageToAll(0xDEEE20FF, "This is just like a RP drift server.");
    SendClientMessageToAll(0xDEEE20FF, "You pick a car and drift.");
    SendClientMessageToAll(0xDEEE20FF, "No teleports.");
    SendClientMessageToAll(0xDEEE20FF, "Aight?.");
    SendClientMessageToAll(0xDEEE20FF, "If you want night, type /night.");
    SendClientMessageToAll(0xDEEE20FF, "Respect admins, Teleports might come when i got time.");
 
   return 1;
  }

  if (strcmp(cmdtext, "/cmds", true) == 0)
  {
    // Send a message to everyone.
    SendClientMessageToAll(0xDEEE20FF, "TIME CMDS: /night /day ");
    SendClientMessageToAll(0xDEEE20FF, "DRIFT CMDS: /drift1-19");
    SendClientMessageToAll(0xDEEE20FF, "OTHER CMDS: /vfix /vflip /v color (ID)(ID).");
 
   return 1;
  }

  return 0;
}
The indentations are screwed, but that should work!

NOTE: For the record, you had too many {}'s


Re: 1 or 2 CMDS in same script. HELP. - Simmeey - 15.04.2009

Thank you man ! Started scripting today.

EDIT: got 2 warnings.

C:\Documents and Settings\SandmaN\Skrivbord\Viper\filterscripts\LOL .pwn(1 : warning 217: loose indentation
C:\Documents and Settings\SandmaN\Skrivbord\Viper\filterscripts\LOL .pwn(2 : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.




Re: 1 or 2 CMDS in same script. HELP. - Weirdosport - 15.04.2009

Yeah I said the indents were pretty screwed! Just play about with tab on those lines until the errors go away, unfortunately with posting on forums and pastebins the indentations do not always go according to plan unless you're relatively careful.


Re: 1 or 2 CMDS in same script. HELP. - Simmeey - 15.04.2009

Aight Ty again.