[AJUDA]Goto e Salvar posiзгo -
.CrazZy._.[De] - 19.09.2011
Eae pessoal *-*, vim aqui encher o saco de vocкs, pedi pra vocкs o seguinte cod:
Provavelmente sгo admins que usa o /goto, entгo resolvi botar pra players tambйm, Procurei no search e:
http://forum.sa-mp.com/showthread.ph...to+para+player achei a mesma coisa que tava procurando, mais tudo deu erro. E tambйm gostaria de pedi pra os players salva posiзгo, dae quando entrasse no server jб iria pro lugar salvo.
Poderiam me ajudar ? (:
Re: [AJUDA]Goto e Salvar posiзгo -
CyNiC - 19.09.2011
Sу var precisar adaptar pra salvar e tirar o sistema de salvar por id.
http://pastebin.com/f679b572a
Re: [AJUDA]Goto e Salvar posiзгo -
WLSF - 19.09.2011
pawn Code:
//TOPO
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;
}
//OnPlayerCommandText
new string[128],
cmd[30],
tmp[30],
idx;
if(!strcmp(cmd,"/goto", true))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USE: /goto ID");
new outro = strval(tmp);
if(outro == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player desconhecido");
new
Float:X,
Float:Y,
Float:Z,
nome[MAX_PLAYER_NAME]
;
GetPlayerPos(outro, X, Y, Z);
SetPlayerPos(playerid, X, Y ,Z);
GetPlayerName(playerid, nome, sizeof(nome));
format(string, 42," Vocк usou /goto no player %s", nome);
SendClientMessage(playerid, -1, string);
return true;
}
Ai й sу aprimorar avontade.
Re: [AJUDA]Goto e Salvar posiзгo -
.CrazZy._.[De] - 19.09.2011
Quote:
Originally Posted by Willian_Luigi
pawn Code:
//TOPO 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; } //OnPlayerCommandText new string[128], cmd[30], tmp[30], idx; if(!strcmp(cmd,"/goto", true)) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USE: /goto ID"); new outro = strval(tmp); if(outro == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player desconhecido"); new Float:X, Float:Y, Float:Z, nome[MAX_PLAYER_NAME] ; GetPlayerPos(outro, X, Y, Z); SetPlayerPos(playerid, X, Y ,Z); GetPlayerName(playerid, nome, sizeof(nome)); format(string, 42," Vocк usou /goto no player %s", nome); SendClientMessage(playerid, -1, string); return true; }
Ai й sу aprimorar avontade.
|
Erro:
pawn Code:
C:\Users\Jefferson\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4548) : error 017: undefined symbol "cmd"
C:\Users\Jefferson\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4548) : warning 215: expression has no effect
C:\Users\Jefferson\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4548) : error 001: expected token: ";", but found "]"
C:\Users\Jefferson\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4548) : error 029: invalid expression, assumed zero
C:\Users\Jefferson\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4548) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
Re: [AJUDA]Goto e Salvar posiзгo -
WLSF - 19.09.2011
mande a linha porfavor. '-'
Re: [AJUDA]Goto e Salvar posiзгo -
.CrazZy._.[De] - 19.09.2011
Quote:
Originally Posted by Willian_Luigi
mande a linha porfavor. '-'
|
cmd[30];
Re: [AJUDA]Goto e Salvar posiзгo -
WLSF - 19.09.2011
Vocк poderia ter apenas copiado e colado
pawn Code:
new string[128],
cmd[30],
tmp[30],
idx;
Re: [AJUDA]Goto e Salvar posiзгo -
.CrazZy._.[De] - 19.09.2011
Quote:
Originally Posted by Willian_Luigi
Vocк poderia ter apenas copiado e colado
pawn Code:
new string[128], cmd[30], tmp[30], idx;
|
Cara jб tentei tudo, dб erro do mesmo jeito.. :S
Re: [AJUDA]Goto e Salvar posiзгo -
WLSF - 19.09.2011
me manda o inicio do seu OnPlayerCommandText
Re: [AJUDA]Goto e Salvar posiзгo -
.CrazZy._.[De] - 19.09.2011
Quote:
Originally Posted by Willian_Luigi
me manda o inicio do seu OnPlayerCommandText
|
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])