/aduty Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /aduty Help (
/showthread.php?tid=436164)
/aduty Help -
NekoChan - 10.05.2013
Could anyone help me ? how to make if i type /aduty and it will hide my Last Name (RP Server)
Re: /aduty Help -
Latisha - 10.05.2013
You have to create the aname command.
AW: /aduty Help -
Blackazur - 10.05.2013
https://sampforum.blast.hk/showthread.php?tid=351068
But this tutorial is a little bit wrong.
Re: AW: /aduty Help -
NekoChan - 10.05.2013
Quote:
Originally Posted by Blackazur
|
I just needed to hide player's Lastname
AW: /aduty Help -
Blackazur - 10.05.2013
https://sampwiki.blast.hk/wiki/ShowPlayerNameTagForPlayer
or try
https://sampwiki.blast.hk/wiki/ShowNameTags
Re: /aduty Help -
Kwarde - 10.05.2013
pawn Код:
stock firstNameOnly(playerid)
{
new Name[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
for (new i = 0; i < (strlen(pName)); i++)
{
if (pName[i] != '_') Name[i] = pName[i];
else break;
}
return Name;
}
This should work
pawn Код:
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(str, 128, "Full name: %s || First name only: %s", pName, firstNameOnly(playerid));
SendClientMessage(playerid, 0xFFFFFFAA, str);
This is one of many ways to do this
p.s.
Kevin_Warde would be
Kevin
KevinWard_e would be
KevinWard
K_evinWarde would be
K
_KevinWarde would be
KevinWarde_ would be
KevinWarde
I think that is what you wanted?
Re: /aduty Help -
NekoChan - 10.05.2013
Quote:
Originally Posted by Kwarde
pawn Код:
stock firstNameOnly(playerid) { new Name[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); for (new i = 0; i < (strlen(pName)); i++) { if (pName[i] != '_') Name[i] = pName[i]; else break; } return Name; }
This should work
pawn Код:
new str[128], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); format(str, 128, "Full name: %s || First name only: %s", pName, firstNameOnly(playerid)); SendClientMessage(playerid, 0xFFFFFFAA, str);
This is one of many ways to do this
p.s.
Kevin_Warde would be Kevin
KevinWard_e would be KevinWard
K_evinWarde would be K
_KevinWarde would be
KevinWarde_ would be KevinWarde
I think that is what you wanted?
|
Where to put it ? Sorry i'm new on scripting~
AW: /aduty Help -
Blackazur - 10.05.2013
The stock can you put anywhere in your script.
Re: /aduty Help -
NekoChan - 10.05.2013
Okay, then how do i make it back to full name ?
Re: /aduty Help -
Kwarde - 10.05.2013
This function doesn't change the player name, just remove the '_{lastname}' part in strings.
If you want to show the full name again, just don't use the function 'firstNameOnly'. For example:
pawn Код:
public OnPlayerText(playerid, text[])
{
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
if(PlayerInfo[playerid][pAdmDuty]) //If the player is on admin duty. Change this to your own string!
format(str, 128, "%s(%d): %s", firstNameOnly(playerid), playerid, text);
else format(str, 128, "%s(%d): %s", pName, playerid, text);
SendClientMessageToAll(0xFFFFFFAA, str);
return 1;
}
If you would be on admin duty, everyone would see (assuming that your ID is 0 and your name Kevin_Warde with the text Hello!):
Kevin(0): Hello!
When you wouldn't be on duty, it would send:
Kevin_Warde(0): Hello!
The name in the server and in the TAB list would be
Kevin_Warde at all time.