Attach
#1

Всем привет, возникла такая проблемка,
Делаю скрипт футбола чтобы мячик атачился, но такая проблема,
Когда приатачился мяч, то его нельзя пнуть вообще
А если без атача то все норм делает
Код
PHP код:

#include <a_samp>
forward PlayerToPoint(Float:radiplayeridFloat:xFloat:yFloat:z);
forward VladenieBall(playerid);
new 
FootBallBall;
new 
PlayGameTheFootBall[MAX_PLAYERS];
public 
OnGameModeInit()
{
    
UsePlayerPedAnims();
    
FootBallBall CreateObject(159889.6156922500.63232415.7893750.00000.00000.0000);
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        
SetPlayerPos(playerid,45.6425,2490.3450,16.4844);
        
SetTimer("Attach",100,1);
        
PlayGameTheFootBall[playerid] = 1;
        return 
1;
    }
    if(!
strcmp(cmdtext"/leave"true))
    {
        
SendClientMessage(playerid0xFFFFFFFF"");
        
PlayGameTheFootBall[playerid] = 0;
        return 
1;
    }
    return 
0;
}
forward Attach(playerid);
public 
Attach(playerid)
{
    new 
Float:PosXFloat:PosYFloat:PosZ;
    
GetObjectPos(FootBallBallPosXPosYPosZ);
    new 
Float:pxFloat:pyFloat:pz;
    if(
PlayerToPoint(1.7,playerid,PosX,PosY,PosZ))
    {
    
GetPlayerPos(playeridpxpypz);
    
GetXYInFrontOfPlayer(playeridpxpy7.0);
    
AttachObjectToPlayer(FootBallBall,playerid,-0.229000,0.548000,-0.232999,0.000000,0.000000,0.000000);
    }
    return 
1;
}
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:yFloat:distance)
{
new 
Float:a;
GetPlayerPos(playeridxya);
GetPlayerFacingAngle(playerida);
if (
GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
+= (distance floatsin(-adegrees));
+= (distance floatcos(-adegrees));
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    new 
Float:PosXFloat:PosYFloat:PosZ;
    
GetObjectPos(FootBallBallPosXPosYPosZ);
    new 
Float:pxFloat:pyFloat:pz;
    new 
Float:angle;
    
GetPlayerFacingAngle(playeridangle);
    if(
newkeys KEY_WALK && PlayGameTheFootBall[playerid] == 1)
    {
    if(
PlayerToPoint(1.7,playerid,PosX,PosY,PosZ))
    {
    
GetPlayerPos(playeridpxpypz);GetXYInFrontOfPlayer(playeridpxpy7.0);
    
MoveObject(FootBallBall,px,py+5,15.789375,10.0);
    
ApplyAnimation(playerid,"FIGHT_D","FightD_1",4.1,0,1,1,0,0);
    }
    }
    }
public 
PlayerToPoint(Float:radiplayeridFloat:xFloat:yFloat:z)
{
if(
IsPlayerConnected(playerid))
{
new 
Float:oldposxFloat:oldposyFloat:oldposz;
new 
Float:tempposxFloat:tempposyFloat:tempposz;
GetPlayerPos(playeridoldposxoldposyoldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((
tempposx radi) && (tempposx > -radi)) && ((tempposy radi) && (tempposy > -radi)) && ((tempposz radi) && (tempposz > -radi)))
{
return 
1;
}
}
return 
0;

Reply


Messages In This Thread
Attach - by Seregamil - 09.04.2012, 03:54
Re: Attach - by RAIDER (RU) - 09.04.2012, 08:20
Re: Attach - by eakwarp - 09.04.2012, 10:23
Re: Attach - by Stepashka - 09.04.2012, 10:49
Re: Attach - by Seregamil - 09.04.2012, 11:54
Re: Attach - by Stepashka - 09.04.2012, 11:59
Re: Attach - by eakwarp - 09.04.2012, 12:06
Re: Attach - by Seregamil - 09.04.2012, 12:06
Re: Attach - by eakwarp - 09.04.2012, 12:09
Re: Attach - by Seregamil - 09.04.2012, 12:19

Forum Jump:


Users browsing this thread: 1 Guest(s)