[HELP]Since u helped me i wanna ask another sumthin
#1

look.
I have one command called /cash
And ive doen another one called /help
But when i type /help
Its doing the cash command
I hope u guys can fix it
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Cash", cmdtext, true, 5) == 0)

   GivePlayerMoney(playerid,100000);
   SendClientMessage(playerid,COLOR_RED,"Here Is Some Cash");
 return 1;
}
{
    if(strcmp("/Help", cmdtext,true,5) == 0)
    SendClientMessage(playerid, COLOR_YELLOW,"Add Them All / To Make It A Command:Rules Cmds Teles Credits");
    return 1;
}
They are together so i need a explenation
P.S sry 4 being such a noob but i wanna learn so the way to learn is to ask
Reply
#2

Try this:

pawn Код:
if(strcmp("/cash",cmdtext, true, 5) == 0)
{
   GivePlayerMoney(playerid,100000);
   SendClientMessage(playerid,COLOR_RED,"Here Is Some Cash");
   return 1;
}
    if(strcmp("/help", cmdtext,true,5) == 0)
    {
    SendClientMessage(playerid, COLOR_YELLOW,"Add Them All / To Make It A Command:Rules Cmds Teles Credits");
    return 1;
}
Reply
#3

C:\Documents and Settings\xp\щемзп дтбегд\Nico.pwn(87) : warning 209: function "OnPlayerCommandText" should return a value
C:\Documents and Settings\xp\щемзп дтбегд\Nico.pwn(87) : error 010: invalid function or declaration
C:\Documents and Settings\xp\щемзп дтбегд\Nico.pwn(90) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

pawn Код:
if(strcmp("/cash",cmdtext, true, 5) == 0)
{
   GivePlayerMoney(playerid,100000);
   SendClientMessage(playerid,COLOR_RED,"Here Is Some Cash");
   return 1;
}
    if(strcmp("/help", cmdtext,true,5) == 0)
    {
    SendClientMessage(playerid, COLOR_YELLOW,"Add Them All / To Make It A Command:Rules Cmds Teles Credits");
    return 1;
}
return 1;
}
Reply
#5

C:\Documents and Settings\xp\щемзп дтбегд\Nico.pwn(87) : warning 209: function "OnPlayerCommandText" should return a value
C:\Documents and Settings\xp\щемзп дтбегд\Nico.pwn(87) : error 055: start of function body without function header
C:\Documents and Settings\xp\щемзп дтбегд\Nico.pwn(8 : error 010: invalid function or declaration
C:\Documents and Settings\xp\щемзп дтбегд\Nico.pwn(90) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Here is the whole Game Mode maybe it'll help
pawn Код:
#include <a_samp>

#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF40FF
main()
{
  print("\n~~~~~~~~~~~~~~~~~~~~");
  print("FreeRoom Server By Nico");
  print("~~~~~~~~~~~~~~~~~~~~\n");
  return 1;
}

public OnGameModeInit()
{
return 1;
}

public OnGameModeExit()
{
  return 1;
}


public OnPlayerConnect(playerid)
{
  new pName[MAX_PLAYER_NAME];
  new string[48];
  GetPlayerName(playerid, pName, sizeof(pName));
  format(string, sizeof(string), "%s has joined Nico's FreeRoom Server.", pName);
  SendClientMessageToAll(0xAAAAAAAA, string);
  SendClientMessage(playerid,COLOR_WHITE,"Welcome To Nico's FreeRoom Server Type /help to all Your help needed");
  return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
  new pName[MAX_PLAYER_NAME], string[56];
  GetPlayerName(playerid, pName, sizeof(pName));
  switch(reason)
  {
    case 0: format(string, sizeof(string), "%s Dont Worry he will brb. (Crashed)", pName);
    case 1: format(string, sizeof(string), "Nico Is Saying Good bye to %s. (Leaving)", pName);
    case 2: format(string, sizeof(string), "%s The Noob got Kicked Or Banned. (Kicked)", pName);
  }
  SendClientMessageToAll(0xAAAAAAAA, string);
  return 1;
}

public OnPlayerSpawn(playerid)
{
  return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
  return 1;
}

public OnVehicleSpawn(vehicleid)
{
  return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
  return 1;
}

public OnPlayerText(playerid, text[])
{
  return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
  SendClientMessage(playerid,COLOR_RED,"PM have sent!");
  return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
if(strcmp("/cash",cmdtext, true, 5) == 0)
{
   GivePlayerMoney(playerid,100000);
   SendClientMessage(playerid,COLOR_RED,"Here Is Some Cash");
   return 0;
}
{
    if(strcmp("/help", cmdtext,true,5) == 0)
    SendClientMessage(playerid, COLOR_YELLOW,"Add Them All / To Make It A Command:Rules Cmds Teles Credits");
    return 1;
}
Thanks if u can fix it
Reply
#6

here Fixed: http://pastebin.com/m5a7b8046
Reply
#7

try this http://pastebin.com/m102301eb
Reply
#8

Why posting pastebin link with fixed script? He will never learn anyways. Just tell him that he misses a bracket.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)