public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/kick", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, ADMIN_RED, "[ERRO] Vocк nгo estб autorizado a usar este comando.");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USO: /kick [ID] [MOTIVO]");
new id;
id = strval(tmp);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, -1, "USO: /kick [ID] [MOTIVO]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "JOGADOR OFFLINE.");
new string[256], n[24], n2[24];
GetPlayerName(id, n, 24);
GetPlayerName(playerid, n2, 24);
format(string, 128, "Vocк kickou o jogador %s [ID: %d] | Motivo: %s.", n, id, result);
SendClientMessage(playerid, -1, string);
format(string, 128, "Vocк foi kickado pelo administrador %s [ID %d] | Motivo: %s.", n2, playerid, result);
SendClientMessage(id, -1, string);
Kick(id);
format(string, 128, "O ADMIN %s kickou o jogador %s | Motivo: %s.", n2, n, result);
SendClientMessageToAll(-1, string);
return 1;
}
return 0;
}
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "tmp"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "idx"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "tmp"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "tmp"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "idx"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "idx"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 029: invalid expression, assumed zero
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "idx"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 076: syntax error in the expression, or invalid function call
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "idx"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "idx"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "idx"
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 029: invalid expression, assumed zero
C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(542) : error: 017: undefined symbol "idx"
528 if(strcmp(cmdtext, "/kick", true) == 0)
529 {
530 if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, GOLD, "[ERRO] Vocк nгo й Administrador!");
531 tmp = strtok(cmdtext, idx);
532 if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USO: /kick [ID] [MOTIVO]");
533 new id;
534 id = strval(tmp);
535 new length = strlen(cmdtext);
536 while ((idx < length) && (cmdtext[idx] <= ' '))
537 {
538 idx++;
539 }
540 new offset = idx;
541 new result[64];
542 while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
543 {
544 result[idx - offset] = cmdtext[idx];
545 idx++;
546 }
547 result[idx - offset] = EOS;
548 if(!strlen(result)) return SendClientMessage(playerid, -1, "USO: /kick [ID] [MOTIVO]");
549 if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "JOGADOR OFFLINE.");
550 new string[256], n[24], n2[24];
551 GetPlayerName(id, n, 24);
552 GetPlayerName(playerid, n2, 24);
553 format(string, 128, "Vocк kickou o jogador %s [ID: %d] | Motivo: %s.", n, id, result);
554 SendClientMessage(playerid, -1, string);
555 format(string, 128, "Vocк foi kickado pelo administrador %s [ID %d] | Motivo: %s.", n2, playerid, result);
556 SendClientMessage(id, -1, string);
557 Kick(id);
558 format(string, 128, "O ADMIN %s kickou o jogador %s | Motivo: %s.", n2, n, result);
559 SendClientMessageToAll(-1, string);
560 return 1;
561 }
new tmp[128], idx;
530 C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(530) : warning: 219: local variable "idx" shadows a variable at a preceding level
1642 C:\Users\Casa\Desktop\SAMP\gamemodes\[PSA].pwn(530) : warning: 203: symbol is never used: "idx"
530 new cmd[256], idx;
PHP код:
pawn Код:
|
//No OnPlayerCommandText:
if(!strcmp("/kick", cmdtext, true, 5))
{
#if defined pAdmin
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,0xFFFFFFAA,"Vocк nгo й um Administrador do servidor !");
#else
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFAA,"Vocк nгo й um Administrador do servidor !");
#endif
new foco[128], foco2[128], text[128], AdminNick[MAX_PLAYER_NAME], KickadoNick[MAX_PLAYER_NAME];
foco = KcmD(1,cmdtext),
foco2 = KcmD(2,cmdtext);
if(!strlen(foco)) return SendClientMessage(playerid,0xFFFFFFAA,"Digite: /kick [id] [motivo]");
if(!strlen(foco2)) return SendClientMessage(playerid,0xFFFFFFAA,"Digite: /kick [id] [motivo]");
GetPlayerName(playerid,AdminNick,MAX_PLAYER_NAME),
GetPlayerName(strval(foco),KickadoNick,MAX_PLAYER_NAME),
format(text,sizeof(text),"[Server] O Administrador %s kickou o jogador %s. Motivo: %s",AdminNick,KickadoNick,foco2),
SendClientMessageToAll(0x33CCFFAA, text),
Kick(strval(foco));
return true;
}
//No Final do seu GM:
stock KcmD(param, cmdtext[])
{
new string[128], pos, var;
format(string, sizeof(string), "%s ", cmdtext);
while((pos = strfind(string, " ", true)) != -1)
{
if(var == param) return string;
var++;
strdel(string, 0, pos + 1);
if(strcmp(string, " ", true, pos) == 0) goto end;
}
end:
string[0] = '\0';
return string;
}
if(strcmp(cmd, "/kick", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, ADMIN_RED, "[ERRO] Vocк nгo estб autorizado a usar este comando.");
tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USO: /kick [ID] [MOTIVO]");
new ID = strval(tmp); //ID
new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; }
new offset = idx, result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; }
result[idx - offset] = EOS; //MOTIVO
if(!strlen(result)) return SendClientMessage(playerid, -1, "USO: /kick [ID] [MOTIVO]");
if(!IsPlayerConnected(ID) || ID == IVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "JOGADOR OFFLINE.");
new string[0x80], nome[MAX_PLAYER_NAME], nome2[MAX_PLAYER_NAME]; GetPlayerName(playerid, nome, sizeof nome); GetPlayerName(ID, nome2, sizeof nome2);
format(string, sizeof string, "Vocк kickou o jogador %s[%i], motivo: %s.", nome2, ID, result);
SendClientMessage(playerid, -1, string);
format(string, sizeof string, "Vocк foi kickado pelo administrador %s motivo: %s.", nome, result);
SendClientMessage(ID, -1, string);
Kick(ID);
format(string, sizeof string, "[ADM] %s kickou o jogador %s motivo: %s.", nome, nome2, result);
SendClientMessageToAll(-1, string);
return 0x01;
}