[Ajuda] Jogar o player para frente - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Jogar o player para frente (
/showthread.php?tid=565669)
Jogar o player para frente -
Ever_SH - 28.02.2015
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));
}
Re: Jogar o player para frente -
PT - 28.02.2015
ja existe uma variavel com esse nome
PHP код:
if((newkeys & 2) && (!IsPlayerInAnyVehicle(playerid)))
{
new Float:zzX, Float:zzY, Float:zzZ;
GetPlayerPos(playerid, zzX, zzY, zzZ);
GetXYInFrontOfPlayer(playerid, zzX, zzY, 1.0); // '1.0' й a distancia.
SetPlayerPos(playerid, zzX, zzY, zzZ);
}
Re: Jogar o player para frente -
Ever_SH - 28.02.2015
Quote:
Originally Posted by PT
ja existe uma variavel com esse nome
PHP код:
if((newkeys & 2) && (!IsPlayerInAnyVehicle(playerid)))
{
new Float:zzX, Float:zzY, Float:zzZ;
GetPlayerPos(playerid, zzX, zzY, zzZ);
GetXYInFrontOfPlayer(playerid, zzX, zzY, 1.0); // '1.0' й a distancia.
SetPlayerPos(playerid, zzX, zzY, zzZ);
}
|
Obrigado, +REP.