Welcome message. -
Michael B - 07.02.2015
Hello!
I have a small issue with this code.
Basically, this is a welcome message, which shows at the player`s login.
The problem is that whenever the player login, the message displays twice, not once.
More than this, it displays when the player comes back from tabbed status or when admins finish spectating a player.
Here is my chat`s log:
Код:
[07:33:31] Connected to {B9C9BF}American Dream Roleplay | 0.3z
[07:33:37]
[07:33:38] Welcome to American Dream Roleplay, {FF6347}Michael Morrison{FFFFFF} !
[07:33:38] Your statistics are:
[07:33:38] Playing hours: 4
[07:33:38] Helper level: 5
[07:33:38] V.I.P level: 5
[07:33:38] Developer level: 6
[07:33:38] Mapper level: 5
[07:33:38] Administrator level: 1338
[07:33:38] {348017}AdmLogin: Administrator Michael Morrison has logged in. (Adminstration Level : 1338)
[07:33:38] You are logged in as a famed player!
[07:33:38] Welcome to American Dream Roleplay, {FF6347}Michael Morrison{FFFFFF} !
[07:33:38] Your statistics are:
[07:33:38] Playing hours: 4
[07:33:38] Helper level: 5
[07:33:38] V.I.P level: 5
[07:33:38] Developer level: 6
[07:33:38] Mapper level: 5
[07:33:38] Administrator level: 1338
[07:33:38] {348017}AdmLogin: Administrator Michael Morrison has logged in. (Adminstration Level : 1338)
[07:33:38] You are logged in as a famed player!
As you see above, the message is sent twice.
Here is the code:
pawn Код:
Spawned[playerid] = 1;
SetPlayerSkillLevel(playerid,WEAPONSKILL_PISTOL,0);
SetPlayerSkillLevel(playerid,WEAPONSKILL_MICRO_UZI,0);
SetPlayerWeapons(playerid);
SetPlayerSpawn(playerid);
PlayerFixRadio(playerid);
gPlayerSpawned[playerid] = 1;
TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);
new string[128];
// Welcome
format(string, sizeof(string), "Welcome to American Dream Roleplay, {FF6347}%s{FFFFFF} !", RPN(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
// Stats
format(string, sizeof(string), "Your statistics are:");
SendClientMessage(playerid, COLOR_WHITE, string);
// Player
format(string, sizeof(string), "Playing hours: %d", PlayerInfo[playerid][pLevel]);
SendClientMessage(playerid, COLOR_WHITE, string);
// Helper
if(PlayerInfo[playerid][pHelper]){
format(string, sizeof(string), "Helper level: %d", PlayerInfo[playerid][pHelper]);
SendClientMessage(playerid, COLOR_WHITE, string);}
// VIP
if(PlayerInfo[playerid][pDonateRank]){
format(string, sizeof(string), "V.I.P level: %d", PlayerInfo[playerid][pDonateRank]);
SendClientMessage(playerid, COLOR_WHITE, string);}
// Developer
if(PlayerInfo[playerid][pDeveloper]){
format(string, sizeof(string), "Developer level: %d", PlayerInfo[playerid][pDeveloper]);
SendClientMessage(playerid, COLOR_WHITE, string);}
// Mappers
if(PlayerInfo[playerid][pMapper]){
format(string, sizeof(string), "Mapper level: %d", PlayerInfo[playerid][pMapper]);
SendClientMessage(playerid, COLOR_WHITE, string);}
// Admin
if(PlayerInfo[playerid][pAdmin]){
format(string, sizeof(string), "Administrator level: %d", PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE, string);}
// Admin Messages
if(PlayerInfo[playerid][pAdmin]){
format(string, sizeof(string), "{348017}AdmLogin: Administrator %s has logged in. (Adminstration Level : %d)", RPN(playerid), PlayerInfo[playerid][pAdmin]);
SendAdminMessage(COLOR_LIGHTBLUE, string);}
// Famed Message
if(PlayerInfo[playerid][pFamed]){
format(string, sizeof(string), "You are logged in as a famed player! ", RPN(playerid), PlayerInfo[playerid][pFamed]);
SendAdminMessage(COLOR_LIGHTBLUE, string);}
// Welcome message
format(string, sizeof(string), "{FFFF00}STAFF: Message.....");
Re: Welcome message. -
Threshold - 07.02.2015
And what callback is this under exactly? -_-
Re: Welcome message. -
Naresh - 07.02.2015
the code u have entered must be under "public OnPlayerConnect"
Try that. it surely will work.
Re: Welcome message. -
Michael B - 07.02.2015
Hmm, it was on public OnPlayerSpawn(playerid), because the server requires a password in order to log in.
If I put it OnPlayerConnect, will show up before logging in.
Re: Welcome message. -
Ritzy2K - 07.02.2015
well...maybe put in when player log in.?
Re: Welcome message. -
Ritzy2K - 07.02.2015
i use i think if gplayerlogged==1 cant remember :P
Re: Welcome message. -
ZombieNest - 07.02.2015
Well...
At OnDialogResponse, Find the DIALOG_LOGIN, Use SetTimerEx("LoginMessageTest", 2500, false, "i", playerid);
and at public LoginMessageTest(playerid) {
use your code...
I really hate NGG edits...
People try to make them unique -.- instead of making own
Re: Welcome message. -
Michael B - 07.02.2015
Alright I'll try it.