10.08.2009, 23:43
trying to give you some info on that one
somwhere in your gamemode (outside a public function):
on top:
somewhere in your gamemode again (also outside a public, cause this is one 2):
in OnPlayerConnect:
EDIT:
forgot to kill the timer
in OnPlayerDisconnect:
I am a beginner as well, report with any bugs ...
Hopes it helps
grts Riz
somwhere in your gamemode (outside a public function):
pawn Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:temPposx, Float:temPposy, Float:temPposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
temPposx = (oldposx -x);
temPposy = (oldposy -y);
temPposz = (oldposz -z);
if (((temPposx < radi) && (temPposx > -radi)) && ((temPposy < radi) && (temPposy > -radi)) && ((temPposz < radi) && (temPposz > -radi)))
{
return 1;
}
//----------------------------------------------------------------------------------------------------------------------------speedo
/*new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z);
if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{ return true; }*/
//-----------------------------------------------------------------------------------------------------------------------stop speedo
return 0;
}
pawn Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
pawn Код:
public IsPlayerNearClub(playerid)
{
if(PlayerToPoint(50.0,playerid,your x,your y,your z)) // change the radius (50.0) if needed, and the coцrdinates ofcourse
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
PlayerPlaySound(playerid, 1139, X, Y, Z); // change the sound to what you would prefer (1139)
}
return 1;
}
pawn Код:
SetTimer("IsPlayerNearClub(playerid)",1000,1); //1000 is checking every second
forgot to kill the timer
in OnPlayerDisconnect:
pawn Код:
KillTimer(IsPlayerNearClub(playerid));
Hopes it helps
grts Riz