[AJUDA] Cmd Frag -
vascaino55 - 08.05.2012
Estou com um pequeno problema, quando eu digito /frag aparece no caso normal o meu frag, mais quando eu difigito /frag [id] .
Por exemplo /frag 1
Era para aparecer frag do player id 1, ou se nao tivesse player aparecer a mensagem "ERRO: ID jogador errado"
pawn Код:
if(!strcmp(cmdtext, "/frag", true)){
new Target;
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,Vermelho,"ERRO: ID jogador errado");
new tname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
format(string, sizeof(string), "Frags de %s" ,tname);
SendClientMessage(playerid ,COLOR_GREEN, string);
format(string, sizeof(string), "Matou %d ves(es) | Morreu %d ves(es) | Dominou %d Area(s) | Grana %d | X1 Ganhos %d | X1 Perdidos %d | Se matou %d" ,PlayerInfo[playerid][pMatou],PlayerInfo[playerid][pMorreu],PlayerInfo[playerid][pDominou],GetPlayerMoney(playerid),PlayerInfo[playerid][Ganhoux1],PlayerInfo[playerid][Perdeux1],PlayerInfo[playerid][pSematou]);
SendClientMessage(playerid ,COLOR_YELLOW, string);
}
else{
new Target;
new pip[20];
GetPlayerIp(Target,pip,sizeof(pip));
format(string,sizeof(string),"{00FF40}Matou {FFFFFF}%d ves(es)\n{00FF40}Morreu {FFFFFF}%d ves(es)\n{00FF40}Dominou {FFFFFF}%d Area(s)\n{00FF40}Grana {FFFFFF}$%d\n{00FF40}X1 Ganhos: {FFFFFF}%d\n{00FF40}X1 Perdidos: {FFFFFF}%d\n{00FF40}Se Matou: {FFFFFF}%d\n",PlayerInfo[playerid][pMatou],PlayerInfo[playerid][pMorreu],PlayerInfo[playerid][pDominou],GetPlayerMoney(playerid),PlayerInfo[playerid][Ganhoux1],PlayerInfo[playerid][Perdeux1],PlayerInfo[playerid][pSematou]);
SendClientMessage(playerid ,COLOR_YELLOW, string);
return 1;
}
Re: [AJUDA] Cmd Frag -
paulor - 08.05.2012
pawn Код:
if(!strcmp(cmdtext, "/frag", true)) {
new tmp[128], idx;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /frag [nick-id]");
new Target = ReturnUser(tmp), tname[MAX_PLAYER_NAME];
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,Vermelho,"ERRO: ID jogador errado");
GetPlayerName(Target,tname,sizeof(tname));
format(string, sizeof(string), "Frags de %s" ,tname);
SendClientMessage(playerid ,COLOR_GREEN, string);
format(string, sizeof(string), "Matou %d ves(es) | Morreu %d ves(es) | Dominou %d Area(s) | Grana %d | X1 Ganhos %d | X1 Perdidos %d | Se matou %d" ,PlayerInfo[Target][pMatou],PlayerInfo[Target][pMorreu],PlayerInfo[Target][pDominou],GetPlayerMoney(Target),PlayerInfo[Target][Ganhoux1],PlayerInfo[Target][Perdeux1],PlayerInfo[Target][pSematou]);
SendClientMessage(playerid ,COLOR_YELLOW, string);
}
Re: [AJUDA] Cmd Frag -
vascaino55 - 08.05.2012
vlw por ajudar, mais ta dando erro:
pawn Код:
D:\SA_MP\gamemodes\X.pwn(7900) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\SA_MP\gamemodes\X.pwn(7900) : warning 219: local variable "idx" shadows a variable at a preceding level
D:\SA_MP\gamemodes\X.pwn(7901) : error 047: array sizes do not match, or destination array is too small
D:\SA_MP\gamemodes\X.pwn(7903) : error 017: undefined symbol "ReturnUser"
Re: [AJUDA] Cmd Frag -
paulor - 08.05.2012
pawn Код:
if(!strcmp(cmdtext, "/frag", true)) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /frag [id]");
new Target = strval(tmp), tname[MAX_PLAYER_NAME];
if(!IsPlayerConnected(Target)) return SendClientMessage(playerid,Vermelho,"ERRO: ID jogador errado");
GetPlayerName(Target,tname,sizeof(tname));
format(string, sizeof(string), "Frags de %s" ,tname);
SendClientMessage(playerid ,COLOR_GREEN, string);
format(string, sizeof(string), "Matou %d ves(es) | Morreu %d ves(es) | Dominou %d Area(s) | Grana %d | X1 Ganhos %d | X1 Perdidos %d | Se matou %d" ,PlayerInfo[Target][pMatou],PlayerInfo[Target][pMorreu],PlayerInfo[Target][pDominou],GetPlayerMoney(Target),PlayerInfo[Target][Ganhoux1],PlayerInfo[Target][Perdeux1],PlayerInfo[Target][pSematou]);
SendClientMessage(playerid ,COLOR_YELLOW, string);
}
Eh foda saber oq cada GM tem neh!
Re: [AJUDA] Cmd Frag -
CidadeNovaRP - 08.05.2012
Nossa, esse code me dб atй nojo:eca:
Isso que dб se acostumar com SSCANF e ZCMD -q