errors
#1

Код:
warning 209: function "GetPlayerTheoreticAngle" should return a value
error 010: invalid function or declaration


}
//Float:GetPlayerTheoreticAngle(playerid)
stock GetPlayerTheoreticAngle(playerid)
{
	new Float:MindAngle = 0.0, Float:angle2 = 0.0;
	if(IsPlayerConnected(playerid))
	{
	    new Float:x, Float:y, Float:z;
		GetPlayerPos(playerid, x, y, z);
		new Float:dis = floatsqroot(floatpower(floatabs(floatsub(x, Drifting[playerid][pPos][0])), 2)+floatpower(floatabs(floatsub(y, Drifting[playerid][pPos][1])), 2));
		if(IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), angle2);
		else GetPlayerFacingAngle(playerid, angle2);
		if(Drifting[playerid][pPos][0] >= x)
		{
		    new Float:tmp = (x >= Drifting[playerid][pPos][0]) ? (x - Drifting[playerid][pPos][0]) : (Drifting[playerid][pPos][0] - x), Float:sin = asin(tmp / dis);
			if(Drifting[playerid][pPos][1] >= y) MindAngle = floatadd(floatsub(floatadd(sin, 90), floatmul(sin, 2)), 90.0);
	  		else MindAngle = floatsub(floatadd(sin, 180), 180.0);
		}
		else
		{
 			if(Drifting[playerid][pPos][1] < y)
			{
			    new Float:tmp2 = (y >= Drifting[playerid][pPos][1]) ? (y - Drifting[playerid][pPos][1]) : (Drifting[playerid][pPos][1] - y), Float:sin = acos(tmp2 / dis);
       			MindAngle = floatsub(floatadd(sin, 360), floatmul(sin, 2));
       		}
       		else
       		{
       		    new Float:tmp = (x >= Drifting[playerid][pPos][0]) ? (x - Drifting[playerid][pPos][0]) : (Drifting[playerid][pPos][0] - x), Float:sin = asin(tmp / dis);
          		MindAngle = floatadd(sin, 180);
          		}
        	}
		}
	}
	return (!MindAngle) ? (angle2) : (MindAngle);
Reply
#2

PHP код:
stock GetPlayerTheoreticAngle(playerid)
{
    new 
Float:MindAngle 0.0Float:angle2 0.0;
    if(
IsPlayerConnected(playerid))
    {
        new 
Float:xFloat:yFloat:z;
        
GetPlayerPos(playeridxyz);
        new 
Float:dis floatsqroot(floatpower(floatabs(floatsub(xDrifting[playerid][pPos][0])), 2)+floatpower(floatabs(floatsub(yDrifting[playerid][pPos][1])), 2));
        if(
IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), angle2);
        else 
GetPlayerFacingAngle(playeridangle2);
        if(
Drifting[playerid][pPos][0] >= x)
        {
            new 
Float:tmp = (>= Drifting[playerid][pPos][0]) ? (Drifting[playerid][pPos][0]) : (Drifting[playerid][pPos][0] - x), Float:sin asin(tmp dis);
            if(
Drifting[playerid][pPos][1] >= yMindAngle floatadd(floatsub(floatadd(sin90), floatmul(sin2)), 90.0);
              else 
MindAngle floatsub(floatadd(sin180), 180.0);
        }
        else
        {
             if(
Drifting[playerid][pPos][1] < y)
            {
                new 
Float:tmp2 = (>= Drifting[playerid][pPos][1]) ? (Drifting[playerid][pPos][1]) : (Drifting[playerid][pPos][1] - y), Float:sin acos(tmp2 dis);
                   
MindAngle floatsub(floatadd(sin360), floatmul(sin2));
               }
               else
               {
                   new 
Float:tmp = (>= Drifting[playerid][pPos][0]) ? (Drifting[playerid][pPos][0]) : (Drifting[playerid][pPos][0] - x), Float:sin asin(tmp dis);
                  
MindAngle floatadd(sin180);
                  }
            }
        }
    return (!
MindAngle) ? (angle2) : (MindAngle);
    } 
Reply
#3

its work but know.. return (!MindAngle) ? (angle2) : (MindAngle); warning 213: tag mismatch
Reply
#4

If you return a floating point value then the function itself must also be declared with a Float: tag.
Reply
#5

but its float

new Float:MindAngle = 0.0, Float:angle2 = 0.0;
Reply
#6

hes talking about this
Код:
stock GetPlayerTheoreticAngle(playerid)
should be
Код:
stock Float:GetPlayerTheoreticAngle(playerid)
or w/e
Reply
#7

if i use

Код:
stock Float:GetPlayerTheoreticAngle(playerid)

function with tag result used before definition, forcing reparse
ohh i fix it.. thanks all for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)