01.05.2014, 22:23
Deve funcionar:
Fiz correndo e nгo compilei/testei, se tiver algum erro й sу avisar.
pawn Код:
new pChannel[MAX_PLAYERS];
CMD:n(playerid, params[]){
if(pChannel[playerid] == 0) return SendClientMessage(playerid, -1, "Vocк nгo estб em nenhum canal");
if(strlen(params) == 0) return SendClientMessage(playerid, -1, "Digite alguma coisa.");
new strin[128];
format(strin, 128, "%s (%d): %s.", PlayerGetName(playerid), playerid, params);
for(new k=0; k<MAX_PLAYERS; k++) if(pChannel[k]==pChannel[playerid]) SendClientMessage(playerid, -1, strin);
return 1;
}
CMD:joinchannel(playerid, params[]){
new strin[128], num;
if(!sscanf(params, "d", num)) return SendClientMessage(playerid, -1, "Digite um canal vбlido.");
if(num==0 && pChannel[playerid]!=0) format(strin, 128, "Vocк saiu do canal.",num);
else if(num==0) format(strin, 128, "Vocк nгo estб em nenhum canal.");
else format(strin, 128, "Vocк entrou no canal %d.",num);
SendClientMessage(playerid, -1, strin);
pChannel[playerid] = num;
return 1;
}
public OnPlayerDisconnect(playerid, reason) {
pChannel[playerid] = 0;
return 1;
}
stock PlayerGetName(playerid)
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, Nome, MAX_PLAYER_NAME);
return Nome;
}