[Ajuda] /irp Por botao, pf me ajuda '-'
#1

Tipo, tenho um sv de drift, e o pessoal gosta de gravar video, e la existe o /s (salva posiзгo) e o /i (carrega posiзгo)
me pediram para fazer isso por botao, no caso, o Y, quando apertar o Y ele verifica se ja foi salvo a posiзгo, se foi ele teleporta atй a posiзгo, ATЙ AI TUDO BEM.
eu queria botar um /irpon (irposiзгo on) e /irpoff (irposiзгo off), se ativar o /irpon, entao voce pode usar o Y para se teleportar.
entao eu fiz assim

no comeзo do gm
pawn Код:
new irposicao[MAX_PLAYERS];
onplayercommandtext
pawn Код:
if(strcmp("/irpoff", cmdtext, true, 18) == 0){
irposicao[playerid] = 0;
SendClientMessage(playerid,-1,"Vocк desativou o {FF0000}/irp{FFFFFF} por botao.");
return true;

}
if(strcmp("/irpon", cmdtext, true, 15) == 0){
irposicao[playerid] = 1;
SendClientMessage(playerid,-1,"Vocк ativou o {FF0000}/irp {FFFFFF}por botao, o botao para carregar a posiзгo й {FF0000}Y");
return true;
}

if (strcmp(cmdtext, "/sp", true)==0 || strcmp(cmdtext, "/s", true)==0)
{
SendClientMessage(playerid, AMARELO, "Vocк salvou a posiзгo, para voltar use /i.");
SendClientMessage(playerid, BRANCO,"Para ativar o irp por botao digite /irpon, o botao para carregar a posiзгo й {FF0000}Y");
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
GetVehiclePos(GetPlayerVehicleID(playerid), PosX[playerid], PosY[playerid], PosZ[playerid]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), PosA[playerid]);
PlayerPlaySound(playerid, 1137 , 0.0, 0.0, 0.0);
}else{
GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
GetPlayerFacingAngle(playerid, PosA[playerid]);
PosI[playerid] = (GetPlayerInterior(playerid));
PlayerPlaySound(playerid, 1137 , 0.0, 0.0, 0.0);}
return 1;
}
Ok, entao quando ele digito /irpon o irposicao virou 1!
agora pra teleportar por botao й o problema

no onplayerkeystatechange
pawn Код:
if((newkeys & KEY_YES) && (IsPlayerInAnyVehicle(playerid)))
{
new id[256];
if(irposicao[strval(id)] == 1)
{
if (!floatsqroot(PosX[playerid]+PosY[playerid]+PosZ[playerid]))
{
return SendClientMessage(playerid, BRANCO, "Primeiro salve com {FF0000}/s");
}
else
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid), PosX[playerid], PosY[playerid], PosZ[playerid]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), PosA[playerid]);
SetCameraBehindPlayer(playerid);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), PosI[playerid]);
}
else
{
EnCoche[playerid] = false;
SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
SetPlayerFacingAngle(playerid, PosA[playerid]);
SetCameraBehindPlayer(playerid);
}
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
SendClientMessage(playerid, BRANCO, "Carregado");
SetPlayerInterior(playerid, PosI[playerid]);
}
return true;
}
Compila perfect, o problema й q quando eu to no sv e digito /irpon, o teleporte com o Y continua sem funcionar, nao teleporta por botao, nao acontece nada, й como se o /irpon nao tivesse alterado o "irposicao[playerid] = 0" para 1.
nao nei o q fazer, to a 1 hora nisso ja kkkk, pf me ajudem '-', se nao entender eu explico de novo
Reply
#2

Quote:
Originally Posted by Suxi
Посмотреть сообщение
Tipo, tenho um sv de drift, e o pessoal gosta de gravar video, e la existe o /s (salva posiзгo) e o /i (carrega posiзгo)
me pediram para fazer isso por botao, no caso, o Y, quando apertar o Y ele verifica se ja foi salvo a posiзгo, se foi ele teleporta atй a posiзгo, ATЙ AI TUDO BEM.
eu queria botar um /irpon (irposiзгo on) e /irpoff (irposiзгo off), se ativar o /irpon, entao voce pode usar o Y para se teleportar.
entao eu fiz assim

no comeзo do gm
pawn Код:
new irposicao[MAX_PLAYERS];
onplayercommandtext
pawn Код:
if(strcmp("/irpoff", cmdtext, true, 18) == 0){
irposicao[playerid] = 0;
SendClientMessage(playerid,-1,"Vocк desativou o {FF0000}/irp{FFFFFF} por botao.");
return true;

}
if(strcmp("/irpon", cmdtext, true, 15) == 0){
irposicao[playerid] = 1;
SendClientMessage(playerid,-1,"Vocк ativou o {FF0000}/irp {FFFFFF}por botao, o botao para carregar a posiзгo й {FF0000}Y");
return true;
}

if (strcmp(cmdtext, "/sp", true)==0 || strcmp(cmdtext, "/s", true)==0)
{
SendClientMessage(playerid, AMARELO, "Vocк salvou a posiзгo, para voltar use /i.");
SendClientMessage(playerid, BRANCO,"Para ativar o irp por botao digite /irpon, o botao para carregar a posiзгo й {FF0000}Y");
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
GetVehiclePos(GetPlayerVehicleID(playerid), PosX[playerid], PosY[playerid], PosZ[playerid]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), PosA[playerid]);
PlayerPlaySound(playerid, 1137 , 0.0, 0.0, 0.0);
}else{
GetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
GetPlayerFacingAngle(playerid, PosA[playerid]);
PosI[playerid] = (GetPlayerInterior(playerid));
PlayerPlaySound(playerid, 1137 , 0.0, 0.0, 0.0);}
return 1;
}
Ok, entao quando ele digito /irpon o irposicao virou 1!
agora pra teleportar por botao й o problema

no onplayerkeystatechange
pawn Код:
if((newkeys & KEY_YES) && (IsPlayerInAnyVehicle(playerid)))
{
new id[256];
if(irposicao[strval(id)] == 1)
{
if (!floatsqroot(PosX[playerid]+PosY[playerid]+PosZ[playerid]))
{
return SendClientMessage(playerid, BRANCO, "Primeiro salve com {FF0000}/s");
}
else
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(GetPlayerVehicleID(playerid), PosX[playerid], PosY[playerid], PosZ[playerid]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), PosA[playerid]);
SetCameraBehindPlayer(playerid);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), PosI[playerid]);
}
else
{
EnCoche[playerid] = false;
SetPlayerPos(playerid, PosX[playerid], PosY[playerid], PosZ[playerid]);
SetPlayerFacingAngle(playerid, PosA[playerid]);
SetCameraBehindPlayer(playerid);
}
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
SendClientMessage(playerid, BRANCO, "Carregado");
SetPlayerInterior(playerid, PosI[playerid]);
}
return true;
}
Compila perfect, o problema й q quando eu to no sv e digito /irpon, o teleporte com o Y continua sem funcionar, nao teleporta por botao, nao acontece nada, й como se o /irpon nao tivesse alterado o "irposicao[playerid] = 0" para 1.
nao nei o q fazer, to a 1 hora nisso ja kkkk, pf me ajudem '-', se nao entender eu explico de novo
if((newkeys & KEY_YES) && (IsPlayerInAnyVehicle(playerid))) = Seu cуdigo esta indicando que precisa esta em um veiculo para que ocorra o teleporte.
Reply
#3

sim!!, precisa estar num veiculo, й isso mesmo, teleportar junto do veiculo,
mesmo dentro do veiculo nada acontece.
esse codigo parece futil mas й mt util. no meu sv os drifters gravam videos, e pra isso, eles precisam tentar varias vezes a mesma cena, eles dao /s e ai /i, pra poupar de apertar t, barra, i, enter, me pediram isso, do Y
por isso esse codigo. porem, nao esta funcionando, simplesmente nao funciona, acho q o valor 1 nao esta chegando no onplayerkeystatechange
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)