[HELP] RemoveUnderScore -
Fredden1993 - 30.08.2010
I got this function called RemoveUnderScore and it works like the sendername it just deletes the Under Score [_] of the player who sent the message.
The functions works like a charm but I need this function to giveplayerid too, so for an example:
format(string, sizeof(string), "** %s gives BlahBlah to %s", RemoveUnderScore(playerid) [HERE]);
There it says [HERE] should the giveplayerid be, but I want it to work like the sendername, it should removes the Under Score on it too.
This is how the function looks like:
Код:
stock RemoveUnderScore(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
}
return name;
}
Thanks
Re: [HELP] RemoveUnderScore -
Claude - 30.08.2010
Use the first one if you use ReturnUser, second if not
pawn Код:
stock RemoveUnderScore(playerid, target)
{
new targetid = ReturnUser(target);
new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME];
GetPlayerName(targetid, targetname, sizeof targetname);
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
if(targetname[i] == '_') targetname[i] = ' ';
}
return name, targetname;
}
pawn Код:
stock RemoveUnderScore(playerid, target)
{
new targetid = strval(target);
new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME];
GetPlayerName(targetid, targetname, sizeof targetname);
GetPlayerName(playerid,name,sizeof(name));
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if(name[i] == '_') name[i] = ' ';
if(targetname[i] == '_') targetname[i] = ' ';
}
return name, targetname;
}
Re: [HELP] RemoveUnderScore -
Fredden1993 - 30.08.2010
Quote:
Originally Posted by Claude
Use the first one if you use ReturnUser, second if not
pawn Код:
stock RemoveUnderScore(playerid, target) { new targetid = ReturnUser(target); new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME]; GetPlayerName(targetid, targetname, sizeof targetname); GetPlayerName(playerid,name,sizeof(name)); for(new i = 0; i < MAX_PLAYER_NAME; i++) { if(name[i] == '_') name[i] = ' '; if(targetname[i] == '_') targetname[i] = ' '; } return name, targetname; }
pawn Код:
stock RemoveUnderScore(playerid, target) { new targetid = strval(target); new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME]; GetPlayerName(targetid, targetname, sizeof targetname); GetPlayerName(playerid,name,sizeof(name)); for(new i = 0; i < MAX_PLAYER_NAME; i++) { if(name[i] == '_') name[i] = ' '; if(targetname[i] == '_') targetname[i] = ' '; } return name, targetname; }
|
Over 50 number of arguments does not match definition, one argument type mismatch (argument 1) and a symbol is never used: "target". When I'm using this, I put RemoveUnderScore(playerid) as you can see on my example, can taht be the reason, do I have to use another code? And yes, I'm using ReturnUser.
Re: [HELP] RemoveUnderScore -
Fredden1993 - 30.08.2010
Sorry for bumping, but this is a urgent need, it's one of my last problems I got.
Re: [HELP] RemoveUnderScore -
[XST]O_x - 30.08.2010
pawn Код:
format(string, sizeof(string), "** %s gives BlahBlah to %s", RemoveUnderScore(playerid),RemoveUnderScore(giveplayerid));
Perhaps?
Re: [HELP] RemoveUnderScore -
Fredden1993 - 30.08.2010
Quote:
Originally Posted by [XST]O_x
pawn Код:
format(string, sizeof(string), "** %s gives BlahBlah to %s", RemoveUnderScore(playerid),RemoveUnderScore(giveplayerid));
Perhaps?
|
Now it says that RemoveUnderScore(playerid): number of arguments does not match definition
And I got around 50 of the RemoveUnderScore(playerid) in my script...
Re: [HELP] RemoveUnderScore -
Fredden1993 - 30.08.2010
For example, this is the first Error Line in my script:
Код:
format(string, sizeof(string), "%s says: %s", RemoveUnderScore(playerid), text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
And yeah, number of arguments does not match definition
Re: [HELP] RemoveUnderScore -
Bumbis - 30.08.2010
I use something like this..
pawn Код:
new name[MAX_PLAYER_NAME];
new string[64];
GetPlayerName(playerid,name,sizeof(name));
name[strfind(name,"_")] = ' ';
format(string,sizeof(string),"Your name is %s",name);
SendClientMessage(playerid,COLOR_GREY,string);
It works and name is without underscore. And btw, its easier, you don't need to write some hard code to gain it. It just requests one line.
Re: [HELP] RemoveUnderScore -
Fredden1993 - 30.08.2010
Quote:
Originally Posted by silvis123
I use something like this..
pawn Код:
new name[MAX_PLAYER_NAME]; new string[64]; GetPlayerName(playerid,name,sizeof(name)); name[strfind(name,"_")] = ' '; format(string,sizeof(string),"Your name is %s",name); SendClientMessage(playerid,COLOR_GREY,string);
It works and name is without underscore. And btw, its easier, you don't need to write some hard code to gain it. It just requests one line.
|
Undefined Symbol "Name"
Re: [HELP] RemoveUnderScore -
Bumbis - 30.08.2010
Hmm.. Maybe i just made a mistake, but i use this in my GM, it works fine without any errors or warnings.