SA-MP Forums Archive
Falling when i dead - 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: Falling when i dead (/showthread.php?tid=368641)



Falling when i dead - [M.A]Angel[M.A] - 14.08.2012

Hello, I got problem that sometimes when i dead im falling in this place (Which will appear in the pic) , and after 4 sec i respawned , its sometimes!
I think problem OnPlayerSpawn? or OnPlayerDeath i will give u both of Codes


Код:
public OnPlayerSpawn(playerid)
{
    ResetPlayerWeapons(playerid);
    GivePlayerWeapon(playerid,26,100);
    GivePlayerWeapon(playerid,24,100);
    PlayerInfo[playerid][SpawnAngle] = 0.0; //so when you leave and another player comes, the camera will start from start
    PlayerInfo[playerid][SpawnDance] = true; //to not execute to much timers
    KillTimer( PlayerInfo[playerid][SpawnTimer] ); //to kill it, since its useless now
    PlayerPlaySound(playerid, 1186, 0.0, 0.0, 0.0); // (blank sound) to shut the music up
    SetCameraBehindPlayer(playerid); //to prevent some bugs
    PlayCrimeReportForPlayer(playerid, playerid, 3);
    SetPlayerFightingStyle(playerid, FIGHT_STYLE_KUNGFU);
	PlayerPlaySound(playerid, 1098,-119.9460,23.1096,12.2238);
    DMZone[playerid] = 0;
	new rand = random(sizeof(RandomPlayerSpawns));
	SetPlayerPos(playerid, RandomPlayerSpawns[rand][0], RandomPlayerSpawns[rand][1], RandomPlayerSpawns[rand][2]);
	return 1;
    }
public OnPlayerDeath(playerid, killerid, reason)
    {
    SendDeathMessage(killerid, playerid, reason);
    KillingSpree[playerid] = 0;
    KillingSpree[killerid]++;
    new file[100],Name[MAX_PLAYER_NAME],Ip[16],name[MAX_PLAYER_NAME];
	GetPlayerName(giveplayerid, name, sizeof(name));
	GetPlayerName(playerid,Name,sizeof(Name));
	GetPlayerIp(playerid,Ip,sizeof(Ip));
	format(file,sizeof(file),PlayerFile,Name);
    PlayerTotalKills[killerid]++;
    PlayerTotalKills[playerid] = 0;
    if(PlayerTotalKills[killerid] == 1) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/firstblood.mp3");
    }
    if(PlayerTotalKills[killerid] == 2) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/doublekill.mp3");
        return 1;
    }
    if(PlayerTotalKills[killerid] == 3) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/killingspree.mp3");
		return 1;
    }
    if(PlayerTotalKills[killerid] == 4) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/dominating.mp3");
        return 1;
    }
    if(PlayerTotalKills[killerid] == 5) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/triplekill.mp3");
        return 1;
    }
    if(PlayerTotalKills[killerid] == 7) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/monsterkill.mp3");
        return 1;
    }
    if(PlayerTotalKills[killerid] == 9) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/wickedsick.mp3");
        return 1;
    }
    if(PlayerTotalKills[killerid] == 11) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/ludicrouskill.mp3");
        return 1;
    }
    if(PlayerTotalKills[killerid] == 13) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/ultrakill.mp3");
        return 1;
    }
    if(PlayerTotalKills[killerid] == 15) {
        PlayAudioStreamForPlayer(killerid, "http://www.pamp3.site40.net/quake/unstoppable.mp3");
        return 1;
    }
	if( DMZone[killerid] >= 1)
	{
		GivePlayerMoney(killerid, 500);
		GivePlayerMoney(playerid, -500);
	    GameTextForPlayer(playerid, "~r~~N~~N~~N~~N~~N~~N~YOUR KILLER~N~~W~RESPAWN AFTER 5 SECONDS..", 7000, 5);
		PlayCrimeReportForPlayer(killerid, killerid, 3);

	}
	if( DMZone[killerid] == 0)
	{
		GivePlayerMoney(killerid, 500);
		GivePlayerMoney(playerid, -500);
	    GameTextForPlayer(playerid, "~r~~N~~N~~N~~N~~N~~N~YOUR KILLER~N~~W~RESPAWN AFTER 5 SECONDS..", 7000, 5);
		PlayCrimeReportForPlayer(killerid, killerid, 3);
	}
    #if defined specdeath
    TogglePlayerSpectating(playerid, 1);
    SetPlayerInterior(playerid, GetPlayerInterior(killerid));
    PlayerSpectatePlayer(playerid, killerid);
    SetTimerEx(#specd, 1000*10, false, "i",playerid);
    #endif
	return 1;
    }
Here is the pic:
http://imageshack.us/photo/my-images/171/samp017hj.png/



please help!


Re : Falling when i dead - BigBaws - 14.08.2012

i will tell you whats your problem is you adidnt added a place where you will be after the death so add this

DOO_SetPlayerPos(playerid,1172.3759,-1321.6317,15.3992); on your scripts of OnPlayerDeath

if it not working add SetPlayerPos(playerid,1172.3759,-1321.6317,15.3992);

If i helps you REP & thanks


Re: Re : Falling when i dead - [M.A]Angel[M.A] - 14.08.2012

Quote:
Originally Posted by BigBaws
Посмотреть сообщение
i will tell you whats your problem is you adidnt added a place where you will be after the death so add this

DOO_SetPlayerPos(playerid,1172.3759,-1321.6317,15.3992); on your scripts of OnPlayerDeath

if it not working add SetPlayerPos(playerid,1172.3759,-1321.6317,15.3992);

If i helps you REP & thanks
No ,there is Random Spawn
Код:
new Float:RandomPlayerSpawns[3][3] = {
	{404.79,2457.21,16.5000},
	{-2633.79,1360.32,7.12},
	{1116.8577,2494.9219,432.4359}
};
Also , when i fall i spawn to the place but after 4 seconds of falling, i need it spawn when i dead not after time and falling as you see


Re : Falling when i dead - BigBaws - 14.08.2012

Try to make a TogglePlayerControl(playerid,True);


Re: Re : Falling when i dead - [M.A]Angel[M.A] - 14.08.2012

Quote:
Originally Posted by BigBaws
Посмотреть сообщение
i will tell you whats your problem is you adidnt added a place where you will be after the death so add this

DOO_SetPlayerPos(playerid,1172.3759,-1321.6317,15.3992); on your scripts of OnPlayerDeath

if it not working add SetPlayerPos(playerid,1172.3759,-1321.6317,15.3992);

If i helps you REP & thanks
Also if you Add SetPlayerPos(playerid,1172.3759,-1321.6317,15.3992); Under OnplayerDeath its will not set u anyplace, only u dead


Re: Re : Falling when i dead - [M.A]Angel[M.A] - 14.08.2012

Quote:
Originally Posted by BigBaws
Посмотреть сообщение
Try to make a TogglePlayerControl(playerid,True);
I dont think its will fix the error, and i got
error 017: undefined symbol "TogglePlayerControl"


Re: Re : Falling when i dead - new121 - 14.08.2012

Quote:
Originally Posted by [M.A]Angel[M.A]
Посмотреть сообщение
I dont think its will fix the error, and i got
error 017: undefined symbol "TogglePlayerControl"
its TogglePlayerControllable, and I know this won't help your issue you but you really should use

PHP код:
  switch(PlayerTotalKills[killerid])
  {
         case 
1: {  PlayAudioStreamForPlayer(killerid"http://www.pamp3.site40.net/quake/firstblood.mp3"); }
         case 
2: {  PlayAudioStreamForPlayer(killerid"http://www.pamp3.site40.net/quake/doublekill.mp3"); }
  } 
and so on it is much more efficient then

PHP код:
  if(PlayerTotalKills[killerid] == 1) {
        
PlayAudioStreamForPlayer(killerid"http://www.pamp3.site40.net/quake/firstblood.mp3");
    }
    if(
PlayerTotalKills[killerid] == 2) {
        
PlayAudioStreamForPlayer(killerid"http://www.pamp3.site40.net/quake/doublekill.mp3");
        return 
1;
    } 



Re : Falling when i dead - BigBaws - 14.08.2012

but the issuse isnt on the Sound he talking about the Spawn on the Dbug Place

Try the TogglePlayerControllable(playerid, 1);

i guess it will works if not get us an answer .



Re : Falling when i dead - [M.A]Angel[M.A] - 14.08.2012

I got error 017: undefined symbol "TogglePlayerControl" and where to put it?


Re: Falling when i dead - Ranama - 14.08.2012

instead of using setplayerpos on spwn you should use https://sampwiki.blast.hk/wiki/SetSpawnInfo on death, then they will automaticly get spawned at the right point.

Hope it helped