08.06.2010, 21:25
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///
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.
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; }
new CorreCara[MAX_PLAYERS];
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;
}
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;
}
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.
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.
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; }
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
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; }