[OnPlayerSpawn] Death Bug
#1

I have a problem with death.. when i spawn within my server (for the first time) it sends the client a message saying "LS TRAIN:" etc. but this also happens when a player dies... E.G using /kill or even just being killed with a firearm..

My "OnPlayerSpawn"

Код:
 

public OnPlayerSpawn(playerid)
{
	if(PlayerInfo[playerid][pPos][0] == 0 && PlayerInfo[playerid][pPos][1] == 0)
	{
	    SetPlayerPos(playerid, 802.4837,-1348.5842,-0.5078);
	    SetPlayerFacingAngle(playerid, 317.1196);
     	PlayAudioStreamForPlayer(playerid, "http://www.fromtexttospeech.com/texttospeech_output_files/0477346001439163656/7585780.mp3");
     	for(new i; i < 25; i++)
     	{
     	    SendClientMessage(playerid, -1, "");
     	}
	    SendClientMessage(playerid, COLOR_ORANGE, "LS TRAIN: This is the last stop, enjoy your stay in Los Santos!");
        return 1;
	}
	else
	{
	    SetPlayerPos(playerid, PlayerInfo[playerid][pPos][0], PlayerInfo[playerid][pPos][1], PlayerInfo[playerid][pPos][2]);
	}
	
	StopAudioStreamForPlayer(playerid);
	return 1;
}
MY OnPlayerDeath is not edited as of yet.
Reply
#2

Yeah i found the problem,but when u want to use "LS Train"?
Код:
 

public OnPlayerSpawn(playerid)
{
	if(PlayerInfo[playerid][pPos][0] == 0 && PlayerInfo[playerid][pPos][1] == 0)
	{
	    SetPlayerPos(playerid, 802.4837,-1348.5842,-0.5078);
	    SetPlayerFacingAngle(playerid, 317.1196);
     	PlayAudioStreamForPlayer(playerid, "http://www.fromtexttospeech.com/texttospeech_output_files/0477346001439163656/7585780.mp3");
     	for(new i; i < 25; i++)
     	{
     	    SendClientMessage(playerid, -1, "");
     	}
	   // SendClientMessage(playerid, COLOR_ORANGE, "LS TRAIN: This is the last stop, enjoy your stay in Los Santos!");
        return 1;
	}
	else
	{
	    SetPlayerPos(playerid, PlayerInfo[playerid][pPos][0], PlayerInfo[playerid][pPos][1], PlayerInfo[playerid][pPos][2]);
	}
	
	StopAudioStreamForPlayer(playerid);
	return 1;
}
Reply
#3

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
Yeah i found the problem,but when u want to use "LS Train"?
Код:
 

public OnPlayerSpawn(playerid)
{
	if(PlayerInfo[playerid][pPos][0] == 0 && PlayerInfo[playerid][pPos][1] == 0)
	{
	    SetPlayerPos(playerid, 802.4837,-1348.5842,-0.5078);
	    SetPlayerFacingAngle(playerid, 317.1196);
     	PlayAudioStreamForPlayer(playerid, "http://www.fromtexttospeech.com/texttospeech_output_files/0477346001439163656/7585780.mp3");
     	for(new i; i < 25; i++)
     	{
     	    SendClientMessage(playerid, -1, "");
     	}
	   // SendClientMessage(playerid, COLOR_ORANGE, "LS TRAIN: This is the last stop, enjoy your stay in Los Santos!");
        return 1;
	}
	else
	{
	    SetPlayerPos(playerid, PlayerInfo[playerid][pPos][0], PlayerInfo[playerid][pPos][1], PlayerInfo[playerid][pPos][2]);
	}
	
	StopAudioStreamForPlayer(playerid);
	return 1;
}
Im using it for when they first spawn... Im wanted them to do the typical hospital respawn. Yet the "LS TRAIN" text.. which should only happen on first spawn. still pops up, and they re-spawn back to the train station.
Reply
#4

You mean when they register for the first time? If yes:

Search when player register,the dialog,when he response,send this message LS train
Reply
#5

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
Yeah i found the problem,but when u want to use "LS Train"?
Код:
 

public OnPlayerSpawn(playerid)
{
	if(PlayerInfo[playerid][pPos][0] == 0 && PlayerInfo[playerid][pPos][1] == 0)
	{
	    SetPlayerPos(playerid, 802.4837,-1348.5842,-0.5078);
	    SetPlayerFacingAngle(playerid, 317.1196);
     	PlayAudioStreamForPlayer(playerid, "http://www.fromtexttospeech.com/texttospeech_output_files/0477346001439163656/7585780.mp3");
     	for(new i; i < 25; i++)
     	{
     	    SendClientMessage(playerid, -1, "");
     	}
	   // SendClientMessage(playerid, COLOR_ORANGE, "LS TRAIN: This is the last stop, enjoy your stay in Los Santos!");
        return 1;
	}
	else
	{
	    SetPlayerPos(playerid, PlayerInfo[playerid][pPos][0], PlayerInfo[playerid][pPos][1], PlayerInfo[playerid][pPos][2]);
	}
	
	StopAudioStreamForPlayer(playerid);
	return 1;
}
Quote:
Originally Posted by Roberto80
Посмотреть сообщение
You mean when they register for the first time? If yes:

Search when player register,the dialog,when he response,send this message LS train
that wont work. because im only doing it for when he SPAWNS.. (yes for the first time) not when he sees the dialogue.
Reply
#6

it is becoz you are using onplayerspawn and that callback called when a player spawn or respawns i think you should use it in Onplayerconnect so it will show only when someone conenct to server

and also show us OnDialogResponse in that register dialog show
Reply
#7

Quote:
Originally Posted by JeaSon
Посмотреть сообщение
it is becoz you are using onplayerspawn and that callback called when a player spawn or respawns i think you should use it in Onplayerconnect so it will show only when someone conenct to server
I already have something or OnPlayerConnect... Could it be possible to make a Stock? "OnPlayerFirstTime" or something?
Reply
#8

Ok then,read this to let it work...
On top of GameMode,add this:
Код:
new bool:FirstTime[MAX_PLAYERS];
Then search when he register,like the dialog,like this
Код:
public OnDialogResponse
Bla bla bla
if(dialogid == dialog_register)
{
bla bla bla
FirstTime[playerid] = true;
}
Ok now OnPlayerSpawn
Код:
if(FirstTime[playerid] == true)
{
FirstTime[playerid] = false;
SendClientMessage(playerid,color,"Ls Train bla bla bla");
}
Enjoy your time
Reply
#9

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
Ok then,read this to let it work...
On top of GameMode,add this:
Код:
new bool:FirstTime[MAX_PLAYERS];
Then search when he register,like the dialog,like this
Код:
public OnDialogResponse
Bla bla bla
if(dialogid == dialog_register)
{
bla bla bla
FirstTime[playerid] = true;
}
Ok now OnPlayerSpawn
Код:
if(FirstTime[playerid] == true)
{
FirstTime[playerid] = false;
SendClientMessage(playerid,color,"Ls Train bla bla bla");
}
Enjoy your time
I love you.
Reply
#10

Quote:
Originally Posted by BarFix
Посмотреть сообщение
I love you.
Haha,thanks
Enjoy your time,if you need more help i'm ready
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)