SA-MP Forums Archive
Name Pull - 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: Name Pull (/showthread.php?tid=567168)



Name Pull [Video Added] - sampkinq - 11.03.2015

How can the name of the person falling Czech ?

Video:

https://www.youtube.com/watch?v=9-hO...ature=*********
Code:
public OnPlayerUpdate(playerid)
{
if(suPatlamaInmeCikma[playerid] == 1)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 0.5, X, Y, 0.0))
{
new killername[MAX_PLAYER_NAME], playername[MAX_PLAYER_NAME],string[256],killerid; //problem
GetPlayerName(killerid, killername, sizeof(killername)); // problem
GetPlayerName(playerid, playername, sizeof(playername)); // problem
format(string, 250, "[Derby]  Player: %s >> %s Water Cuts", killername,playername); // problem
SendClientMessageToAll(-1,string); // problem

ddSira--;
katildim[playerid] = 0;
suPatlamaInmeCikma[playerid] = 0;
DestroyVehicle(ddAraba[playerid]);
SetPVarInt(playerid,"katildi",0);
SpawnPlayer(playerid);
}}
return 1;
}
- My English is bad. Sorry



Re: Name Pull - CalvinC - 11.03.2015

Shouldn't this be in OnPlayerDeath?
Also, can you explain your problem a bit better?


AW: Name Pull - Kaliber - 11.03.2015

Quote:
Originally Posted by sampkinq
View Post
[CENTER]How can the name of the person falling Czech ?
Sry, i don't understand this question


Re: AW: Name Pull - sampkinq - 11.03.2015

give a name to drop the player into the water


Re: Name Pull - sampkinq - 11.03.2015

Video Added


Re: Name Pull - sampkinq - 11.03.2015

Help me


AW: Re: Name Pull - Kaliber - 11.03.2015

Quote:
Originally Posted by sampkinq
View Post
Help me
So try it like this:

Code:
public OnPlayerUpdate(playerid)
{
	if(suPatlamaInmeCikma[playerid] == 1)
	{
		new Float:X, Float:Y, Float:Z;
		GetPlayerPos(playerid, X, Y, Z);
		if(IsPlayerInRangeOfPoint(playerid, 0.5, X, Y, 0.0))
		{
			new pName[MAX_PLAYER_NAME],string[128];
			GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
			new pID = GetClosestPlayer(playerid);
			if(pID == INVALID_PLAYER_ID) {
			    format(string,128,"[Derby] Player: %s has fallen in the water.",pName);
			    SendClientMessageToAll(-1,string);
			} else {
			    new kName[MAX_PLAYER_NAME];
				GetPlayerName(pID, kName, MAX_PLAYER_NAME);
				format(string, 128, "[Derby]  Player: %s >> %s Water Cuts", pName,kName);
				SendClientMessageToAll(-1,string);
			}
			ddSira--;
			katildim[playerid] = 0;
			suPatlamaInmeCikma[playerid] = 0;
			DestroyVehicle(ddAraba[playerid]);
			SetPVarInt(playerid,"katildi",0);
			SpawnPlayer(playerid);
		}
	}
	return 1;
}
stock GetClosestPlayer(playerid) {
	new Float:p[3],i,Float:x,Float:t=70.0,tmp;
	GetPlayerPos(playerid,p[0],p[1],p[2]);
	for(; i<MAX_PLAYERS; i++) {
	    if(!IsPlayerConnected(i)) continue;
	    x = GetPlayerDistanceFromPoint(i,p[0],p[1],p[2]);
	    if(x < t) t = x,tmp=i;
	}
	return (t==70.0)?INVALID_PLAYER_ID:tmp;
}
Greekz


Re: AW: Re: Name Pull - sampkinq - 11.03.2015

Quote:
Originally Posted by Kaliber
View Post
So try it like this:

Code:
public OnPlayerUpdate(playerid)
{
	if(suPatlamaInmeCikma[playerid] == 1)
	{
		new Float:X, Float:Y, Float:Z;
		GetPlayerPos(playerid, X, Y, Z);
		if(IsPlayerInRangeOfPoint(playerid, 0.5, X, Y, 0.0))
		{
			new pName[MAX_PLAYER_NAME],string[128];
			GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
			new pID = GetClosestPlayer(playerid);
			if(pID == INVALID_PLAYER_ID) {
			    format(string,128,"[Derby] Player: %s has fallen in the water.",pName);
			    SendClientMessageToAll(-1,string);
			} else {
			    new kName[MAX_PLAYER_NAME];
				GetPlayerName(pID, kName, MAX_PLAYER_NAME);
				format(string, 128, "[Derby]  Player: %s >> %s Water Cuts", pName,kName);
				SendClientMessageToAll(-1,string);
			}
			ddSira--;
			katildim[playerid] = 0;
			suPatlamaInmeCikma[playerid] = 0;
			DestroyVehicle(ddAraba[playerid]);
			SetPVarInt(playerid,"katildi",0);
			SpawnPlayer(playerid);
		}
	}
	return 1;
}
stock GetClosestPlayer(playerid) {
	new Float:p[3],i,Float:x,Float:t=70.0,tmp;
	GetPlayerPos(playerid,p[0],p[1],p[2]);
	for(; i<MAX_PLAYERS; i++) {
	    if(!IsPlayerConnected(i)) continue;
	    x = GetPlayerDistanceFromPoint(i,p[0],p[1],p[2]);
	    if(x < t) t = x,tmp=i;
	}
	return (t==70.0)?INVALID_PLAYER_ID:tmp;
}
Greekz
same problem


AW: Re: AW: Re: Name Pull - Kaliber - 11.03.2015

Quote:
Originally Posted by sampkinq
View Post
same problem
Oh yeah i failed, write the function like this:

Code:
stock GetClosestPlayer(playerid) {
	new Float:p[3],i,Float:x,Float:t=70.0,tmp;
	GetPlayerPos(playerid,p[0],p[1],p[2]);
	for(; i<MAX_PLAYERS; i++) {
	    if(!IsPlayerConnected(i) || i == playerid) continue;
	    x = GetPlayerDistanceFromPoint(i,p[0],p[1],p[2]);
	    if(x < t) t = x,tmp=i;
	}
	return (t==70.0)?INVALID_PLAYER_ID:tmp;
}
Greekz


Re: AW: Re: AW: Re: Name Pull - sampkinq - 12.03.2015

Quote:
Originally Posted by Kaliber
View Post
Oh yeah i failed, write the function like this:

Code:
stock GetClosestPlayer(playerid) {
	new Float:p[3],i,Float:x,Float:t=70.0,tmp;
	GetPlayerPos(playerid,p[0],p[1],p[2]);
	for(; i<MAX_PLAYERS; i++) {
	    if(!IsPlayerConnected(i) || i == playerid) continue;
	    x = GetPlayerDistanceFromPoint(i,p[0],p[1],p[2]);
	    if(x < t) t = x,tmp=i;
	}
	return (t==70.0)?INVALID_PLAYER_ID:tmp;
}
Greekz
Thank You !