[AJUDA] Ir mais pra frente quando apertar espaзo
#1

Tipo, euvi no [KaE] o cmd /correr, q quando vc aperta espaзo o player vai pra frente, como se ele corresse, alguem explica comofas///
Reply
#2

Код:
Se eu nгo me engano para frente й o X entгo tu faz tipo assim...

new Float:X, Float:Y, Float:Z;
GetPlayerPos(plid,X,Y,Z);
SetPlayerPos(plid, X+20, Y, Z);
20 = Distвncia que ele ia para frente, se nгo for no X tenta no Y o Z nгo й й altura..
Esse mйtodo dб para fazer o /tapa tб ligado....

Dъvidas sу perguntar, se nгo conseguir fazer eu faзo para tu.
EDIT, fiz para vocк manolo, realmente era no X, comando /correr id...

Код:
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/correr", true))
if(IsPlayerAdmin(playerid)){
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFAA, "USE: /correr [id].");
return 1;
}
new plid;
plid = strval(tmp);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(plid,X,Y,Z);
SetPlayerPos(plid, X+10, Y, Z);
return 1;
}
else{
SendClientMessage(playerid, 0xFFFFFFAA, "Vocк nгo tem permissгo!");
return 1;
}
Reply
#3

Assim:

Topo GM:
pawn Код:
new CorreCara[MAX_PLAYERS];
Agora Final GM:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_FIRE))//TECLA QUE ATIRA
    {
     if(CorreCara[playerid] == 1){
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    SetPlayerPos(playerid, X+10, Y, Z);//Sу Ira Aumentar para Lado X
    }
}
    return 1;
}
Agora comando para Liberar os "CORRER"

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(!strcmp(cmdtext, "/correon", true))
  {
   CorreCara[playerid] = 1;  
   return 1;  
  }
 if(!strcmp(cmdtext, "/correoff", true))
  {
   CorreCara[playerid] = 0;  
   return 1;  
  }
  return 0;
}
Reply
#4

/\
Desculpa, nгo tinha visto que vocк queria por tecla, mal.
Reply
#5

Quando estб sem o " Comando " aparece 1 error

Код:
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(782) : error 017: undefined symbol "PRESSED"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Mas quando eu boto o cmd

da todos esses erros

Код:
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(442) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(443) : warning 219: local variable "string" shadows a variable at a preceding level
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(455) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(456) : warning 219: local variable "string" shadows a variable at a preceding level
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(522) : warning 219: local variable "string" shadows a variable at a preceding level
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(540) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(543) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(547) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(549) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(551) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(556) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(560) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(562) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(569) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(575) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(584) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(593) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(600) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(608) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(615) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(619) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(622) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(625) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(627) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(630) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(632) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(635) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(637) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(640) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(643) : error 010: invalid function or declaration
C:\DOCUME~1\User\Desktop\SAMPSE~2\GAMEMO~1\mibrTDM.pwn(646) : error 010: invalid function or declaration

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#6

Код:
Coloque assim

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys(KEY_FIRE))//TECLA QUE ATIRA
{
     if(CorreCara[playerid] == 1){
     new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    SetPlayerPos(playerid, X+10, Y, Z);//Sу Ira Aumentar para Lado X
}
}
return 1;
}
Reply
#7

Comando tu Ta Colocando Errado, Deve Estar colocando return e } { A Mais

Topo GM:


pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

@[BR]Michael:


Nгo Tem Nada Haver com o Erro, Undefined Pressed, Apenas Precisa Fazer isso Acima
Reply
#8

Ou dб para fazer assim... eu me equivoquei...

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(newkeys == KEY_FIRE)
	{
	if(CorreCara[playerid] == 1){
	new Float:X, Float:Y, Float:Z;
 	GetPlayerPos(playerid,X,Y,Z);
	SetPlayerPos(playerid, X+10, Y, Z);//Sу Ira Aumentar para Lado X
	}
	}
	return 1;
}
Reply
#9

Aewwww, funfow, mais pessoal, ele sу vai pro lado X, como faz pra ele ir pra frente dele, tipo, eu to de lado, ele sу vai pro sul, ele sу desce o mapa \/

dai eu preciso q ele vбi pra onde o player estб virado, como faz?
Reply
#10

Ao invйs de por +10 no X coloque no Y, o Z й altura, caso vocк queria que ele suba
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)