SendPlayerCommand
#1

Hello!
I need a function like SendRCONCommands but for normal commands.

I've tried to do this:
Код:
#define SendPlayerCommand(%0,%1) CallLocalFunction("OnPlayerCommandText", "ds", %0, %1);

public OnPlayerCommandText(playerid, cmdtext[])
{  
if (!strcmp("/command", cmdtext))
	{
    	SendPlayerCommand(playerid,"/vehicles");
		return 1;
	}
return 0;
}
but i have this error:

Код:
C:\ParadiseCityServer\likers.pwn(1039) : error 036: empty statement

Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Hello!

PHP код:
#define SendPlayerCommand(%0,%1); CallLocalFunction("OnPlayerCommandText", "ds", %0, %1);
public OnPlayerCommandText(playeridcmdtext[])
{
    if (!
strcmp("/command"cmdtext))
    {
        
SendPlayerCommand(playerid,"/vehicles");
        return 
1;
    }
    return 
0;

EDIT:
@******: I removed the other code

Mencent
Reply
#3

Try this:

pawn Код:
#define SendPlayerCommand(%0,%1)  CallLocalFunction("OnPlayerCommandText", "ds", %0, %1)

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp("/command", cmdtext))
    {
        SendPlayerCommand(playerid,"/vehicles");
        return 1;
    }
    return 0;
}
Reply
#4

@Ahmad45123:
That will not work, because you have to put in #define the semicolon and do not remove)
Look at you my code above.

Mencent
Reply
#5

Why not make it a stock?
PHP код:
stock SendPlayerCommand(playeridcmdtext[]) CallLocalFunction("OnPlayerCommandText""is"playeridcmdtext); 
Reply
#6

Quote:
Originally Posted by Mencent
Посмотреть сообщение
@Ahmad45123:
That will not work, because you have to put in #define the semicolon and do not remove)
Look at you my code above.

Mencent
It doesn't matter at all.

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Why not make it a stock?
PHP код:
stock SendPlayerCommand(playeridcmdtext[]) CallLocalFunction(playeridcmdtext); 
"stock" is not function.. : https://sampforum.blast.hk/showthread.php?tid=570635
Also wrong number of arguments: https://sampwiki.blast.hk/wiki/CallLocalFunction
Reply
#7

Thanks guys!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)