How it's made ?! - 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: How it's made ?! (
/showthread.php?tid=351638)
How it's made ?! -
x96664 - 16.06.2012
Hi, I want to ask you how can I make when I or any player in my server log-in with rcon password to set before his name (Admin) in the chat.For an example: I enter the server with nickname x96664 and when I type /rcon login password and my name goes (Admin)x96664.
Re: How it's made ?! -
Kindred - 16.06.2012
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success) //If the password was correct
{
new originalname[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME]; //Creates the new variables
GetPlayerName(playerid, originalname, sizeof(originalname)); //Gets current name
format(string, sizeof(string), "(Admin)%s", originalname); //Adds (Admin) to the front of the name
SetPlayerName(playerid, string); //Sets the name to the new name
}
return 1;
}
Untested, just an example.
Simply states that if the player attempts to log into rcon, and succeeds, it gets his current name and set's his name to (Admin), along with his originalname following it afterwards.
EDIT: Sorry, forgot there was no playerid parameter in here (they should have one)
Re: How it's made ?! -
x96664 - 16.06.2012
2 errors:
Код:
error 017: undefined symbol "playerid"
Re: How it's made ?! -
ViniBorn - 16.06.2012
Quote:
Originally Posted by Kindred
pawn Код:
public OnRconLoginAttempt(ip[], password[], success) { if(success) //If the password was correct { new originalname[MAX_PLAYER_NAME], string[MAX_PLAYER_NAME]; //Creates the new variables GetPlayerName(playerid, originalname, sizeof(originalname)); //Gets current name format(string, sizeof(string), "(Admin)%s", originalname); //Adds (Admin) to the front of the name SetPlayerName(playerid, string); //Sets the name to the new name } return 1; }
Untested, just an example.
Simply states that if the player attempts to log into rcon, and succeeds, it gets his current name and set's his name to (Admin), along with his originalname following it afterwards.
|
It don't works ...
Use GetPlayerIp
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success)
{
new VBIP[16];
for(new v , b = GetMaxPlayers(); v != b; v++)
{
GetPlayerIp(v, VBIP, 16);
if(!strcmp(VBIP, ip))
{
new VBName[MAX_PLAYER_NAME], VBNewname[MAX_PLAYER_NAME+7];
GetPlayerName(v, VBName, MAX_PLAYER_NAME);
format(VBNewname, sizeof(VBNewname), "(Admin)%s", VBName);
SetPlayerName(v, VBNewname);
break;
}
}
}
return 1;
}
Re: How it's made ?! -
x96664 - 16.06.2012
Quote:
Originally Posted by Viniborn
It don't works ...
Use GetPlayerIp
pawn Код:
public OnRconLoginAttempt(ip[], password[], success) { if(success) { new VBIP[16]; for(new v , b = GetMaxPlayers(); v != b; v++) { GetPlayerIp(v, VBIP, 16); if(!strcmp(VBIP, ip)) { new VBName[MAX_PLAYER_NAME], VBNewname[MAX_PLAYER_NAME+7]; GetPlayerName(v, VBName, MAX_PLAYER_NAME); format(VBNewname, sizeof(VBNewname), "(Admin)%s", VBName); SetPlayerName(v, VBNewname); break; } } } return 1; }
|
Thank you, your one is wotking!
Re: How it's made ?! -
x96664 - 21.06.2012
How can I make the text "Admin" without the bracets to be in blue ? Using this color {2817E3} .
Re: How it's made ?! -
tyler12 - 21.06.2012
pawn Код:
#include a_samp
public OnPlayerText(playerid, text[])
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
if(IsPlayerAdmin(playerid))
{
format(string,sizeof string,"{2817E3}(Admin){FFFFFF}%s:%s",pName,text);
SendClientMessageToAll(-1,string);
}
return 1;
}
sorry for it being so messy