[AJUDA]Goto e Salvar posiзгo
#1

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 ? (:
Reply
#2

Sу var precisar adaptar pra salvar e tirar o sistema de salvar por id.

http://pastebin.com/f679b572a
Reply
#3

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.
Reply
#4

Quote:
Originally Posted by Willian_Luigi
View Post
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.
Reply
#5

mande a linha porfavor. '-'
Reply
#6

Quote:
Originally Posted by Willian_Luigi
View Post
mande a linha porfavor. '-'
cmd[30];
Reply
#7

Vocк poderia ter apenas copiado e colado
pawn Code:
new string[128],
cmd[30],
tmp[30],
idx;
Reply
#8

Quote:
Originally Posted by Willian_Luigi
View Post
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
Reply
#9

me manda o inicio do seu OnPlayerCommandText
Reply
#10

Quote:
Originally Posted by Willian_Luigi
View Post
me manda o inicio do seu OnPlayerCommandText
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)