error 035: argument type mismatch (argument 1)
#1

I have no idea how to fix the error, any help is appreciated.
PHP код:
#define POLICE 2
#define AP 3
    
if(strcmp(cmd"/dr"true) == || strcmp(cmd"/dept"true) == 0)
    {
    new 
length strlen(cmdtext);
    while ((
idx length) && (cmdtext[idx] <= ' '))
    {
    
idx++;
    }
        new 
offset idx;
        new 
DeptName[10];
         new 
name[24];
        new 
result[256];
        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
        {
        
result[idx offset] = cmdtext[idx];
        
idx++;
        }
        
result[idx offset] = EOS;
        if(!
strlen(result))
        {
        
SendClientMessage(playeridCOLOR_WHITE"Usage: (/dr) [team chat]");
        return 
1;
        }
        if(
gTeam[playerid] == POLICEDeptName "SASP";
        else if(
gTeam[playerid] == APDeptName "Agency";
        
GetPlayerName(playeridname24);
        
SendFactionMessage(resultPOLICEAP); // <------The error line
          
return 1;
    }
stock SendFactionMessage(DeptName,name,result[],faction2faction3)
{
    for(new 
i=0MAX_PLAYERS ;i++)
    {
        if(
IsPlayerConnected(i))
        {
          if(
gTeam[i] == faction2 || gTeam[i] == faction3)
          { 
        
SendClientMessage(i,COLOR_ORANGE,gstr);
        
format(gstrsizeof(gstr), "[%s] %s says: %s"DeptNamenameresult);
        }
        }
    }

Reply
#2

You should to declare "DeptName" and "Name" as array.

pawn Код:
stock SendFactionMessage(DeptName[], name[], result[], faction2, faction3)
And in the line error, try this:

pawn Код:
SendFactionMessage(DeptName, name, result, POLICE, AP);
I think it' so, I really don't understand your code at all.
Reply
#3

Quote:
Originally Posted by EnzoMetlc
Посмотреть сообщение
You should to declare "DeptName" and "Name" as array.

pawn Код:
stock SendFactionMessage(DeptName[], name[], result[], faction2, faction3)
And in the line error, try this:

pawn Код:
SendFactionMessage(DeptName, name, result, POLICE, AP);
I think it' so, I really don't understand your code at all.
It works, can't thank you enough for this!
Reply
#4

Glad you fixed it but for future
When you are making stock like this
PHP код:
stock SendFactionMessage(DeptName,name,result[],faction2faction3
And when you use it later everything between parantheses need to be filled in. All arguments

Good luck
Reply
#5

Quote:
Originally Posted by Micko123
Посмотреть сообщение
Glad you fixed it but for future
When you are making stock like this
PHP код:
stock SendFactionMessage(DeptName,name,result[],faction2faction3
And when you use it later everything between parantheses need to be filled in. All arguments

Good luck
For everyone who call function a stock: https://sampforum.blast.hk/showthread.php?tid=570635
Reply
#6

Quote:
Originally Posted by Micko123
Посмотреть сообщение
Glad you fixed it but for future
When you are making stock like this
PHP код:
stock SendFactionMessage(DeptName,name,result[],faction2faction3
And when you use it later everything between parantheses need to be filled in. All arguments

Good luck
I just found a problem, when I turn the server on and type the command and something for the chat, the first line will be empty and each time you type something new in the command it would go invisible until you decide to type a new thing. Simply said, when you write something with the command, you don't see the current one and the previously said thing shows up. For example, if I say /dr 1 then /dr 2 then /dr 3, it will show up as "blank space | /dr 1 and /dr 2."
Is there any way to fix this?
Reply
#7

Ahh sorry man I saw stock there and wrote it xD I don't even use it in my GM
Reply
#8

Quote:
Originally Posted by cs_waller
Посмотреть сообщение
I just found a problem, when I turn the server on and type the command and something for the chat, the first line will be empty and each time you type something new in the command it would go invisible until you decide to type a new thing. Simply said, when you write something with the command, you don't see the current one and the previously said thing shows up. For example, if I say /dr 1 then /dr 2 then /dr 3, it will show up as "blank space | /dr 1 and /dr 2."
Is there any way to fix this?
Dude, just use a command processor and sscanf. I'm pretty sure it will solve some of your problems. The way you are writing the commands is just slow and long.(I suggest Command Processor by SickAttack).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)