[Ajuda] Jogar o player para frente
#1

Estou tentando fazer uma tecla em que o player aperte e vб para frente, mas da as seguinte warning:
local variable "Z" shadows a variable at a preceding level

Estou usando o Cуdigo abaixo que achei aki no fуrum.

pawn Код:
if((newkeys & 2) && (!IsPlayerInAnyVehicle(playerid)))
    {
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    GetXYInFrontOfPlayer(playerid, X, Y, 1); // '5' й a distancia.
    SetPlayerPos(playerid, X, Y, Z);
    }
pawn Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    GetPlayerFacingAngle(playerid, a);
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
}
Reply
#2

ja existe uma variavel com esse nome

PHP код:
if((newkeys 2) && (!IsPlayerInAnyVehicle(playerid)))
{
     new 
Float:zzXFloat:zzYFloat:zzZ;
     
GetPlayerPos(playeridzzXzzYzzZ);
     
GetXYInFrontOfPlayer(playeridzzXzzY1.0); // '1.0' й a distancia.
     
SetPlayerPos(playeridzzXzzYzzZ);

Reply
#3

Quote:
Originally Posted by PT
Посмотреть сообщение
ja existe uma variavel com esse nome

PHP код:
if((newkeys 2) && (!IsPlayerInAnyVehicle(playerid)))
{
     new 
Float:zzXFloat:zzYFloat:zzZ;
     
GetPlayerPos(playeridzzXzzYzzZ);
     
GetXYInFrontOfPlayer(playeridzzXzzY1.0); // '1.0' й a distancia.
     
SetPlayerPos(playeridzzXzzYzzZ);

Obrigado, +REP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)