/me command
#1

I scripted this /me command but it seems it has one error, can anyone fix it up?
Код:
CMD:me(playerid, params[])
{
	if(isnull(params)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX: /me [action]");
	new string[128];
	format(string, sizeof(string), "* %s %s ", GetPlayerName(playerid), params);
	ProxDetector(30.0, playerid, string, 0xFF0000FF);
	return 1;
}
The error below:
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(47) : warning 202: number of arguments does not match definition
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(47) : warning 202: number of arguments does not match definition
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(4 : error 017: undefined symbol "ProxDetector"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

are you sure you have ProxDetector already? if yes show it, no? here is it

PHP код:
stock ProxDetector(playerid, Float:max_range, color, string[], Float:max_ratio = 1.6)
{
    new
        
Float:pos_x,
        
Float:pos_y,
        
Float:pos_z,
        
Float:range,
        
Float:range_ratio,
        
Float:range_with_ratio,
        
clr_r, clr_g, clr_b,
        
Float:color_r, Float:color_g, Float:color_b;
    if (!
GetPlayerPos(playerid, pos_x, pos_y, pos_z)) {
        return 
0;
    }
    
color_r = float(color >> 24 & 0xFF);
    
color_g = float(color >> 16 & 0xFF);
    
color_b = float(color >> 8 & 0xFF);
    
range_with_ratio = max_range * max_ratio;
#if defined foreach
    
foreach (new i : Player) {
#else
    
for (new i = GetPlayerPoolSize(); i != -1; i--) {
#endif
        
if (!IsPlayerStreamedIn(i, playerid)) {
            continue;
        }
        
range = GetPlayerDistanceFromPoint(i, pos_x, pos_y, pos_z);
        if (
range > max_range) {
            continue;
        }
        
range_ratio = (range_with_ratio - range) / range_with_ratio;
        
clr_r = floatround(range_ratio * color_r);
        
clr_g = floatround(range_ratio * color_g);
        
clr_b = floatround(range_ratio * color_b);
        
SendClientMessage(i, (color & 0xFF) | (clr_b << 8) | (clr_g << 16) | (clr_r << 24), string);
    }
    
SendClientMessage(playerid, color, string);
    return 
1;
} 
EDIT: there is another error there, in your usage of GetPlayerName, its not like that if you want it that simple use a stock
PHP код:
stock GetName(playerid)
{
    new 
name[24]; GetPlayerName(playerid, name, 24); return name;
} 
PHP код:
CMD:me(playerid, params[])
{
    if(
isnull(params)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX: /me [action]");
    new 
string[128];
    
format(string, sizeof(string), "* %s %s ", GetName(playerid), params);
    
ProxDetector(30.0, playerid, string, 0xFF0000FF);
    return 
1;
} 
Reply
#3

tried the php code you sent and this shows up.
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(49) : error 017: undefined symbol "GetName"
C:\Users\homie\Desktop\script\gamemodes\Untitled.p wn(50) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

add this somewhere in you script
PHP код:
stock GetName(playerid) 
{ 
    new 
name[24]; GetPlayerName(playerid, name, 24); return name; 
} 
And again, do you have ProxDetector already?
Reply
#5

Honestly. ProxDetector is outdated.
Use: https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint or even get the distance between the players.
Reply
#6

add me on skype i have a perfekt /me filterscript if u would like linus.45
Reply
#7

Quote:
Originally Posted by Rix70
Посмотреть сообщение
add me on skype i have a perfekt /me filterscript if u would like linus.45
a /me command is literally about 4 lines of code.. Why would you put it in a filterscript?
Reply
#8

This post can help you
https://sampforum.blast.hk/showthread.php?tid=597904
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)