Speed Player/Veh And HP
#1

Код:
#include <a_samp>

public OnPlayerConnect(playerid)
{
	GetPlayerSpeed(playerid);
	GetVehicleSpeed(GetPlayerVehicleID(playerid));
	GetVehicleHP(GetPlayerVehicleID(playerid));
	return 1;
}

stock GetPlayerSpeed(playerid)
{
	new Float:X,Float:Y,Float:Z;
	GetPlayerVelocity(playerid,X,Y,Z);
	return floatsqroot(floatround((X * X + Y * Y + Z * Z) * 200));
}

stock GetVehicleSpeed(vehicleid)
{
	new Float:X,Float:Y,Float:Z;
	GetVehicleVelocity(vehicleid,X,Y,Z);
	return floatsqroot(floatround((X * X + Y * Y + Z * Z) * 200));
}

stock GetVehicleHP(vehicleid)
{
	new Float:Health;
	GetVehicleHealth(vehicleid,Health);
	return floatsqroot(floatround(Health / 10));
}
Код:
C:\Documents and Settings\user\Pulpit\Server\gamemodes\GM.pwn(15) : warning 213: tag mismatch
C:\Documents and Settings\user\Pulpit\Server\gamemodes\GM.pwn(22) : warning 213: tag mismatch
C:\Documents and Settings\user\Pulpit\Server\gamemodes\GM.pwn(29) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Why?
Reply
#2

pawn Код:
stock GetPlayerSpeed(playerid)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerVelocity(playerid,X,Y,Z);
    return floatround(floatsqroot(X * X + Y * Y + Z * Z) * 200.00);
}

stock GetVehicleSpeed(vehicleid)
{
    new Float:X,Float:Y,Float:Z;
    GetVehicleVelocity(vehicleid,X,Y,Z);
    return floatround(floatsqroot(X * X + Y * Y + Z * Z) * 200.00);
}

stock GetVehicleHP(vehicleid)
{
    new Float:Health;
    GetVehicleHealth(vehicleid,Health);
    return floatround(floatsqroot(Health / 10.00));
}
Here.
Reply
#3

Replace your code with :

Код:
#include <a_samp>

public OnPlayerConnect(playerid)
{
	GetPlayerSpeed(playerid);
	GetVehicleSpeed(GetPlayerVehicleID(playerid));
	GetVehicleHP(GetPlayerVehicleID(playerid));
	return 1;
}

stock GetPlayerSpeed(playerid)
{
        if(playerid != INVALID_PLAYER_ID)
        {
                new Float:Pos[3],Float:PS;
                GetPlayerVelocity(playerid, Pos[0], Pos[1], Pos[2]);
                PS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
                return floatround(PS,floatround_round);
        }
        return INVALID_PLAYER_ID;
}

stock GetVehicleSpeed(vehicleid)
{
        if(vehicleid != INVALID_VEHICLE_ID)
        {
                new Float:Pos[3],Float:VS ;
                GetVehicleVelocity(vehicleid, Pos[0], Pos[1], Pos[2]);
                VS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
                return floatround(VS,floatround_round);
        }
        return INVALID_VEHICLE_ID;
}
Reply
#4

Quote:
Originally Posted by [IKS]Niko_Hs™
Посмотреть сообщение
Replace your code with :

Код:
#include <a_samp>

public OnPlayerConnect(playerid)
{
	GetPlayerSpeed(playerid);
	GetVehicleSpeed(GetPlayerVehicleID(playerid));
	GetVehicleHP(GetPlayerVehicleID(playerid));
	return 1;
}

stock GetPlayerSpeed(playerid)
{
        if(playerid != INVALID_PLAYER_ID)
        {
                new Float:Pos[3],Float:PS;
                GetPlayerVelocity(playerid, Pos[0], Pos[1], Pos[2]);
                PS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
                return floatround(PS,floatround_round);
        }
        return INVALID_PLAYER_ID;
}

stock GetVehicleSpeed(vehicleid)
{
        if(vehicleid != INVALID_VEHICLE_ID)
        {
                new Float:Pos[3],Float:VS ;
                GetVehicleVelocity(vehicleid, Pos[0], Pos[1], Pos[2]);
                VS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
                return floatround(VS,floatround_round);
        }
        return INVALID_VEHICLE_ID;
}
You missed third. GetVehicleHP.
Reply
#5

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
pawn Код:
stock GetPlayerSpeed(playerid)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerVelocity(playerid,X,Y,Z);
    return floatround(floatsqroot(X * X + Y * Y + Z * Z) * 200.00);
}

stock GetVehicleSpeed(vehicleid)
{
    new Float:X,Float:Y,Float:Z;
    GetVehicleVelocity(vehicleid,X,Y,Z);
    return floatround(floatsqroot(X * X + Y * Y + Z * Z) * 200.00);
}

stock GetVehicleHP(vehicleid)
{
    new Float:Health;
    GetVehicleHealth(vehicleid,Health);
    return floatround(floatsqroot(Health / 10.00));
}
Here.
Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)