AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved client_print() vs engclient_print() (https://forums.alliedmods.net/showthread.php?t=332526)

kww 05-17-2021 14:03

client_print() vs engclient_print()
 
Hi there! What are the differences between these 2 natives?

PHP Code:

/* Sends message to player. Set index to 0 to send text globaly. */
native client_print(index,type,const message[],any:...);

/* Sends message to player by engine. Set index to 0 to send text globaly. */
native engclient_print(player,type,const message[],any:...); 


Shadows Adi 05-17-2021 14:52

Re: client_print() vs engclient_print()
 
Code:
Sends message to player
native client_print()

Code:
Sends message to player by engine
native engclient_print()

kww 05-17-2021 18:47

Re: client_print() vs engclient_print()
 
Quote:

Originally Posted by Shadows Adi (Post 2747095)
Code:
Sends message to player
native client_print()

Code:
Sends message to player by engine
native engclient_print()

I can read xd. But where is the difference between message sent by engine and not?

Bugsy 05-17-2021 19:16

Re: client_print() vs engclient_print()
 
engclient_print()
Spoiler


client_print()
Spoiler

jimaway 05-17-2021 19:28

Re: client_print() vs engclient_print()
 
client print uses TextMsg, engclient_print uses SVC_PRINT/SVC_CENTERPRINT

not 100% sure on this, but i think messages sent with engclient_print can be hooked/edited/blocked by other plugins but with client_print messages you can't do that

fysiks 05-18-2021 00:27

Re: client_print() vs engclient_print()
 
If it is analogous to client_cmd() and engclient_cmd() then client_print() is for sending a message to one or all players from the server and engclient_print() is for forcing a player to send a message without sending the message to the player's client console first (i.e. instead of using client_cmd(id, "say hello world")).

Quote:

Originally Posted by jimaway (Post 2747125)
not 100% sure on this, but i think messages sent with engclient_print can be hooked/edited/blocked by other plugins but with client_print messages you can't do that

If this analogy is true, it wouldn't be hookable by any plugins. For engclient_cmd(), a new command, amxclient_cmd(), had to be created so that it could be hooked by a plugin.

This can easily be tested.


All times are GMT -4. The time now is 02:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.