[HELP] Commands wont work...
#1

Why i got error in this?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  
	if(strcmp(cmd, "/test", true) == 0) {
		if(gTeam[playerid] == TEAM_ARMY)
		  {
        SendPlayerFormattedText(playerid,"You are in army.",0);
        }else{
        SendPlayerFormattedText(playerid,"You are not in the army",0);
        }
		}
  	return 1;
	}
		
		
	return 0;
}
When i compile is say this :

Код:
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm.pwn(460) : warning 235: public function lacks forward declaration (symbol "SetupPlayerForClassSelection")
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm.pwn(562) : error 010: invalid function or declaration
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm.pwn(599) : warning 203: symbol is never used: "strtok"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
What do i do?

Sorry for my english...

Reply
#2

plz show me those lines :


line 460 : ...............
line 562 : ................
line 599 : ...............
Reply
#3

Код:
460 :---->> public SetupPlayerForClassSelection(playerid)

{

	SetPlayerInterior(playerid,14);

	SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);

	SetPlayerFacingAngle(playerid, 90.0);

	SetPlayerCameraPos(playerid,256.0815,-43.0475,1003.0234);

	SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);

}
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  
	if(strcmp(cmd, "/test", true) == 0) {
		if(gTeam[playerid] == TEAM_ARMY)
		  {
        SendPlayerFormattedText(playerid,"You are in army.",0);
        }else{
        SendPlayerFormattedText(playerid,"You are not in the army",0);
        }
		}
  	562 :----->>>return 1;
	}
		
		
	return 0;
}
Theres no 599... i only got 598 lines....
Reply
#4

search on your script for strtok and delete it...

the on top of script add

pawn Код:
forward SetupPlayerForClassSelection(playerid);
Reply
#5

Now i got this error

C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(563) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Codes :

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  
	if(strcmp(cmd, "/test", true) == 0) {
		if(gTeam[playerid] == TEAM_ARMY)
		  {
        SendPlayerFormattedText(playerid,"You are in army.",0);
        }else{
        SendPlayerFormattedText(playerid,"You are not in the army",0);
        }
		}
  	return 1;
	}
		
		
	563 : ---->>>>>>return 0;
}
Reply
#6

try with this one
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];

    if(strcmp(cmd, "/test", true) == 0)
    {
        if(gTeam[playerid] == TEAM_ARMY)
        {
        SendPlayerFormattedText(playerid,"You are in army.",0);
    }
        else
        {
        SendPlayerFormattedText(playerid,"You are not in the army",0);
    }
    return 1;
    }
    return 0;
}
Reply
#7

that is the right code

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  
	if(strcmp(cmd, "/test", true) == 0) {
		if(gTeam[playerid] == TEAM_ARMY)
		  {
        SendPlayerFormattedText(playerid,"You are in army.",0);
        }
        else
        {
        SendPlayerFormattedText(playerid,"You are not in the army",0);
		}
  	    return 1;
	    } 
	return 0;
}
Reply
#8

Working great! Thank you for helping me!
Reply
#9

Quote:
Originally Posted by [AC
Etch ]
that is the right code

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];
  
	if(strcmp(cmd, "/test", true) == 0) {
		if(gTeam[playerid] == TEAM_ARMY)
		  {
        SendPlayerFormattedText(playerid,"You are in army.",0);
        }
        else
        {
        SendPlayerFormattedText(playerid,"You are not in the army",0);
		}
  	    return 1;
	    } 
	return 0;
}
nearly same as mine...
Reply
#10

sorry didn't see urs (dont even try to think i copied)
Reply
#11

Euhm.... when i do other commands like /no ... its doesn't say Unknown command... it say You are not from the army .. why? i gonna try to add an other command to see what it gonna do..
Reply
#12

I got 2 warning if a add this command...

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256];

	if(strcmp(cmd, "/test", true) == 0)
	{
		if(gTeam[playerid] == TEAM_ARMY)
 		{
  		SendPlayerFormattedText(playerid,"You are in army.",0);
   	}
 		else
 		{
  		SendPlayerFormattedText(playerid,"You are not in the army",0);
   	}
   	return 1;
	}
		if(strcmp(cmd, "/test2", true) == 0)
	{
		if(gTeam[playerid] == TEAM_TALIBAN)
 		{
  		SendPlayerFormattedText(playerid,"You are a Taliban.",0);
   	}
 		else
 		{
  		SendPlayerFormattedText(playerid,"You are not a Taliban",0);
   	}
   	return 1;
	}
	
	return 0;
}
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(563) : warning 217: loose indentation
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(576) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Warnings.



Line 563 its if(strcmp(cmd, "/test2", true) == 0)
Line 576 its return 0;
Reply
#13

put that in top of ur script under ur includes : #pragma tabsize 0
and all warnings should be gone
Reply
#14

Even if i do /test or /test 2 its say You are in Army.... and if i do a random command that is no in my scrip like /blablabla it say You are not in army... why?

Srry for my english... and i dont got a warning...
Reply
#15

try that :

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext,"/test", true) == 0)
	{
		if(gTeam[playerid] == TEAM_ARMY)
 		{
  		SendPlayerFormattedText(playerid,"You are in army.",0);
   	    }
 		else return SendPlayerFormattedText(playerid,"You are not in the army",0);
   	    }
		if(strcmp(cmdtext,"/test2", true) == 0) {
	    {
		if(gTeam[playerid] == TEAM_TALIBAN)
 		{
  		SendPlayerFormattedText(playerid,"You are a Taliban.",0);
   	    }
 		else return SendPlayerFormattedText(playerid,"You are not a Taliban",0);
   	    }
   	return 0;
}
Reply
#16

Quote:
Originally Posted by [AC
Etch ]
try that :

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext,"/test", true) == 0)
	{
		if(gTeam[playerid] == TEAM_ARMY)
 		{
  		SendPlayerFormattedText(playerid,"You are in army.",0);
   	    }
 		else return SendPlayerFormattedText(playerid,"You are not in the army",0);
   	    }
		if(strcmp(cmdtext,"/test2", true) == 0) {
	    {
		if(gTeam[playerid] == TEAM_TALIBAN)
 		{
  		SendPlayerFormattedText(playerid,"You are a Taliban.",0);
   	    }
 		else return SendPlayerFormattedText(playerid,"You are not a Taliban",0);
   	    }
   	return 0;
}
Holy crap xD i got all these error when i put ur code

C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(554) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(556) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(562) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(564) : error 004: function "SendPlayerFormattedText" is not implemented
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(56 : error 029: invalid expression, assumed zero
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(56 : error 004: function "SendPlayerFormattedText" is not implemented
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(56 : error 029: invalid expression, assumed zero
C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(56 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Reply
#17

sorry for that , forgot a bracket
right one :
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext,"/test", true) == 0)
	{
		if(gTeam[playerid] == TEAM_ARMY)
 		{
  		SendPlayerFormattedText(playerid,"You are in army.",0);
   	    }
 		else return SendPlayerFormattedText(playerid,"You are not in the army",0);
   	    }
		if(strcmp(cmdtext,"/test2", true) == 0)
	    {
		if(gTeam[playerid] == TEAM_TALIBAN)
 		{
  		SendPlayerFormattedText(playerid,"You are a Taliban.",0);
   	    }
 		else return SendPlayerFormattedText(playerid,"You are not a Taliban",0);
   	    }
   	return 0;
}
Reply
#18

It all work great... but a got 1 warning

C:\Documents and Settings\Daniel\Desktop\GTA\Server\gamemodes\sftdm .pwn(573) : warning 209: function "SendPlayerFormattedText" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.


and when i do /test or /test2 it say what it need to say... but it say Unknown Command too... why?
Reply
#19

can u give me the line plz?
Reply
#20

public SendPlayerFormattedText(playerid, const str[], define)
{
new tmpbuf[256];
format(tmpbuf, sizeof(tmpbuf), str, define);
SendClientMessage(playerid, 0xFF004040, tmpbuf);
Line 573 -->>> }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)