Weird mistake?
#1

How come such a simple command fails to function?

Tried these out;

Code:
CMD:b(playerid, params[])
{
	new textstr[130];
	if(sscanf(params, "s[130]", textstr))
	{
	    new msg[128], msg2[128];
		format(msg, sizeof(msg), "(( %s [%i]: %s ))", PlayerRPName(playerid), playerid, params);
		ProxDetector(5.0, playerid, msg, COLOR_WHITE, COLOR_GRAD1, COLOR_GRAD2, COLOR_GRAD3, COLOR_GRAD4);
		format(msg2, sizeof(msg2), "[low]: %s", params);
		SetPlayerChatBubble(playerid, msg2, COLOR_WHITE, 5.0, 10000);
	}
	else return SendUsageMessage("/b [msg]");
	return 1;
}
Code:
CMD:b(playerid, params[])
{
	new textstr[130];
	if(isnull(params)) return SendUsageMessage("/b [msg]");
    new msg[128], msg2[128];
	format(msg, sizeof(msg), "(( %s [%i]: %s ))", PlayerRPName(playerid), playerid, params);
	ProxDetector(5.0, playerid, msg, COLOR_WHITE, COLOR_GRAD1, COLOR_GRAD2, COLOR_GRAD3, COLOR_GRAD4);
	format(msg2, sizeof(msg2), "[low]: %s", params);
	SetPlayerChatBubble(playerid, msg2, COLOR_WHITE, 5.0, 10000);
	return 1;
}
Code:
CMD:b(playerid, params[])
{
	new textstr[130];
	if(isnull(params)) return SendUsageMessage("/b [msg]");
	format(textstr, sizeof(textstr), "(( %s [%i]: %s ))", PlayerRPName(playerid), playerid, params);
	ProxDetector(5.0, playerid, textstr, COLOR_WHITE, COLOR_GRAD1, COLOR_GRAD2, COLOR_GRAD3, COLOR_GRAD4);
	format(textstr, sizeof(textstr), "[low]: %s", params);
	SetPlayerChatBubble(playerid, textstr, COLOR_WHITE, 5.0, 10000);
	return 1;
}
They all do the same, see pic;



Code:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	if(gPlayerLogged[playerid] == 0) return SendErrorPrefix(playerid, "You must be logged in before you can use any command!");
	if(!success)
	{
	    new erstr[130];
	    format(erstr, sizeof(erstr), "{FFFFFF}[{FF6347}ERROR{FFFFFF}]{FF6347} '%s' has not been found in our database, please use /help.", cmdtext);
	    return SendClientMessage(playerid, COLOR_LIGHTRED, erstr);
	}
	printf("[cmd] [%s] %s", PlayerRPName(playerid), cmdtext);
	return 1;
}
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	return 1;
}
Got no filter scripts.
Reply
#2

Check my topic, I think we HAD the same issuee
https://sampforum.blast.hk/showthread.php?tid=580573
Reply
#3

Quote:
Originally Posted by Sime30
View Post
Check my topic, I think we HAD the same issuee
https://sampforum.blast.hk/showthread.php?tid=580573
That indeed is my issue!

I have this as a rp name replacer;

Code:
stock str_replace(sSearch, sReplace, const sSubject[], &iCount = 0)
{
	new sReturn[128];
	format(sReturn, sizeof(sReturn), sSubject);
	for(new i = 0; i < sizeof(sReturn); i++)
	{
		if(sReturn[i] == sSearch)
		{
			sReturn[i] = sReplace;
		}
	}
	return sReturn;
}

stock PlayerRPName(playerid)
{
	new name[MAX_PLAYER_NAME];
	strmid(name, str_replace('_', ' ', PlayerName(playerid)), 0, MAX_PLAYER_NAME);
	return name;
}
Do you suggest me to change?
Reply
#4

Yes, just use this, it's working for me perfectly!

Quote:

InGameChatRemoveUnderscore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = strlen(name)-1; i > -1; i--)
if(name[i] == '_')
name[i] = ' ';

return name;
}

Reply
#5

Quote:
Originally Posted by Sime30
View Post
Yes, just use this, it's working for me perfectly!
Nope I'm still getting it
Reply
#6

Try this:
Code:
CMD:b(playerid, params[])
{
	new
	    string[128],
	    Localooc[100];
	if(sscanf(params, "s[100]", Localooc))
	{
	    SendClientMessage(playerid, -1, "USAGE: /(b) [message]");
	    return 1;
	}
	else
	{
	    format(string, sizeof(string), "%s:((%s))!",GetName(playerid),Localooc);
	    ProxDetector(50.0, playerid, string, -1);
	}
	return 1;
}
Reply
#7

Quote:
Originally Posted by JaydenJason
View Post
Nope I'm still getting it
How does your /b command look like now?
Reply
#8

Quote:
Originally Posted by Sime30
View Post
How does your /b command look like now?
Code:
CMD:b(playerid, params[])
{
	new textstr[130];
	format(textstr, sizeof(textstr), "(( %s [%i]: %s ))", PlayerRPName(playerid), playerid, params);
	ProxDetector(5.0, playerid, textstr, COLOR_WHITE, COLOR_GRAD1, COLOR_GRAD2, COLOR_GRAD3, COLOR_GRAD4);
}
ps; the name changing thing didn't work
Reply
#9

This is a lot longer code, but if this doesn't work then it is your ProxDetector or something else because this thing worked for me.

pawn Code:
CMD:b(playerid, params[])
{
    new textstr[130];
    format(textstr, sizeof(textstr), "(( %s [%i]: %s ))", ReplaceString("_", " ", PlayerName(playerid)), playerid, params);
    ProxDetector(5.0, playerid, textstr, COLOR_WHITE, COLOR_GRAD1, COLOR_GRAD2, COLOR_GRAD3, COLOR_GRAD4);
}

stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}

stock ReplaceString(search[], replace[], source[])
{
    new string[256], length;
    for(new i = 0; i < strlen(source); i ++)
    {
        if(strlen(search) > 1 && i != (strlen(source) - 1))
        {
            new bool:match = false, start = i;
            for(new j = 0; j < strlen(search) && !match; j ++)
            {
                if(source[i] != search[j] && j == 0)
                {
                    string[length] = source[i];
                    match = true;
                }
                else
                {
                    if(source[i] == search[j]) i ++;
                    else match = true;
                }
            }

            if(match == true)
            {
                while(start <= i)
                {
                    string[length] = source[start];
                    length ++;
                    start ++;
                }
            }
            else
            {
                for(new j; j < strlen(replace); j ++)
                {
                    string[length] = replace[j];
                    length ++;
                }

                i = (start + (strlen(search) - 1));
            }
        }
        else
        {
            if(strlen(search) == 1 && source[i] == search[0])
            {
                for(new j; j < strlen(replace); j ++)
                {
                    string[length] = replace[j];
                    length ++;
                }
            }
            else
            {
                string[length] = source[i];
                length ++;
            }
        }
    }

    string[length] = EOS;
    return string;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)