[Ajuda] SetScore
#1

O comando /setscore [id] [score] mais so seta o score 0 alguem poderia me ajudar cуdigo :
pawn Код:
if(strcmp(cmd,"/setscore",true) == 0)
    {
    tmp = strtok(cmdtext, idx);
    new pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pID, score;
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, Sucesso, "[USO CORRETO] /setscore [id] [score]");
    return 1;
    }
    pID = strval(tmp);
    GetPlayerName(playerid, name, sizeof(name));
    score = strval(tmp);
    GetPlayerName(pID, pName, sizeof(pName));
    format(string, sizeof(string), "Admin %s lhe deu score %d ", name, score);
    SendClientMessage(pID, -1, string);
    format(string, sizeof(string), "Voce deu score %d para o para o player %s", score, pName);
    SendClientMessage(playerid, -1, string);
    SetPlayerScore(pID, score);
    Score[playerid] += score;
    return 1;
    }
Quem poder me ajudar vlw
Reply
#2

Alguem me ajuda ae por favor
Reply
#3

pawn Код:
if(strcmp(cmd,"/setscore",true) == 0)
{
    new pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pID, score;
    if(!strlen(cmdtext[9]))
    {
        SendClientMessage(playerid, Sucesso, "[USO CORRETO] /setscore [id] [score]");
        return 1;
    }
    pID = strval(cmdtext[9]);
    GetPlayerName(playerid, name, sizeof(name));
     score = strval(cmdtext[10]);
    GetPlayerName(pID, pName, sizeof(pName));
    format(string, sizeof(string), "Admin %s lhe deu score %d ", name, score);
    SendClientMessage(pID, -1, string);
    format(string, sizeof(string), "Voce deu score %d para o para o player %s", score, pName);
    SendClientMessage(playerid, -1, string);
    SetPlayerScore(pID, score);
    Score[playerid] += score;
    return 1;
    }
Reply
#4

Fmz mano vou testar vlw manin
Reply
#5

Deu nao mano ainda ta setando o score 0
Reply
#6

Quote:
Originally Posted by denis15711
Посмотреть сообщение
Deu nao mano ainda ta setando o score 0
Usa o botao de editar...
pawn Код:
if(strcmp(cmd,"/setscore",true) == 0)
{
    tmp = strtok(cmdtext, idx);
    new pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pID, score;
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, Sucesso, "[USO CORRETO] /setscore [id] [score]");
        return 1;
    }
    pID = strval(tmp);
    GetPlayerName(playerid, name, sizeof(name));
    score = strval(tmp+1);
    GetPlayerName(pID, pName, sizeof(pName));
    format(string, sizeof(string), "Admin %s lhe deu score %d ", name, score);
    SendClientMessage(pID, -1, string);
    format(string, sizeof(string), "Voce deu score %d para o para o player %s", score, pName);
    SendClientMessage(playerid, -1, string);
    SetPlayerScore(pID, score);
    Score[playerid] += score;
    return 1;
}
E sei lб, nao uso strtok
Usas sscanf? e.e
Reply
#7

Error :

pawn Код:
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1728) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1728) : error 033: array must be indexed (variable "-unknown-")
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1729) : error 033: array must be indexed (variable "-unknown-")
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1731) : error 035: argument type mismatch (argument 1)
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1736) : error 035: argument type mismatch (argument 1)
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1738) : error 035: argument type mismatch (argument 1)
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1729) : warning 204: symbol is assigned a value that is never used: "tmp2"
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1728) : warning 204: symbol is assigned a value that is never used: "tmp"
Nas linha :
pawn Код:
new tmp = strtok(cmdtext, idx);
    new tmp2 = strtok(cmdtext, idx);
    if(!strlen(tmp))
    pID = strval(tmp);
    score = strval(tmp2);
Reply
#8

Quote:
Originally Posted by denis15711
Посмотреть сообщение
Vou testar aki mano
Quando testares, carregua neste botao do teu ultimo post
EDIT:
Usa isto
pawn Код:
if(strcmp(cmd,"/setscore",true) == 0)
{
    tmp = strtok(cmdtext, idx);
    new tmp2 = strtok(cmdtext, idx);
    new pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pID, score;
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, Sucesso, "[USO CORRETO] /setscore [id] [score]");
        return 1;
    }
        pID = strval(tmp);
        GetPlayerName(playerid, name, sizeof(name));
        score = strval(tmp2);
        GetPlayerName(pID, pName, sizeof(pName));
        format(string, sizeof(string), "Admin %s lhe deu score %d ", name, score);
        SendClientMessage(pID, -1, string);
        format(string, sizeof(string), "Voce deu score %d para o para o player %s", score, pName);
        SendClientMessage(playerid, -1, string);
        SetPlayerScore(pID, score);
        Score[playerid] += score;
        return 1;
}
Edit 2: codigo editado.
E usa o botao de editar, so quando jб postas-te e ninguem postou depois de ti e.e...
podes fazer um post novo
Reply
#9

2 Erro :
pawn Код:
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1729) : error 033: array must be indexed (variable "-unknown-")
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1738) : error 035: argument type mismatch (argument 1)
Linhas :
pawn Код:
new tmp2 = strtok(cmdtext, idx);
score = strval(tmp2);
Reply
#10

Quote:
Originally Posted by denis15711
Посмотреть сообщение
2 Erro :
pawn Код:
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1729) : error 033: array must be indexed (variable "-unknown-")
C:\Users\Denis\Desktop\dodo\GTA\filterscripts\FSDenis1.pwn(1738) : error 035: argument type mismatch (argument 1)
Linhas :
pawn Код:
new tmp2 = strtok(cmdtext, idx);
score = strval(tmp2);
Mete na linha debaixo onde tens "new tmp", mete isto:
pawn Код:
new tmp2[256];
E depois usa este codigo:

pawn Код:
if(strcmp(cmd,"/setscore",true) == 0)
{
    tmp = strtok(cmdtext, idx);
    tmp2 = strtok(cmdtext, idx);
    new pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pID, score;
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, Sucesso, "[USO CORRETO] /setscore [id] [score]");
        return 1;
    }
        pID = strval(tmp);
        GetPlayerName(playerid, name, sizeof(name));
        score = strval(tmp2);
        GetPlayerName(pID, pName, sizeof(pName));
        format(string, sizeof(string), "Admin %s lhe deu score %d ", name, score);
        SendClientMessage(pID, -1, string);
        format(string, sizeof(string), "Voce deu score %d para o para o player %s", score, pName);
        SendClientMessage(playerid, -1, string);
        SetPlayerScore(pID, score);
        Score[playerid] += score;
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)