[Ajuda] /gov tempo -
vitorpedro - 15.10.2011
Se me ajudarem ficarei agradecido
aki eu simplesmente queria por aki um determinado tempo no /gov prara que o playes tiversse que esperar pra mandar novamnete tipo uns 3 minutos
Код:
if(strcmp(cmd, "/governo", true) == 0 || strcmp(cmd, "/gov", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo й um policial !");
return 1;
}
if(PlayerInfo[playerid][pRank] < 5)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк precisar ter cargo maior ou igual а 5 !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
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))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: (/gov)erno [texto]");
return 1;
}
SendClientMessageToAll(COLOR_WHITE, "|___________ Notнcias governamentais ___________|");
for(new luplay=0;luplay<6;luplay++){
if(strfind(result, IP[luplay], true) != -1){result = "PКGO EM FRБGRANTE!!!Jogador tentando divulgar algum IP.";}}
if(PlayerInfo[playerid][pMember] == 7)
{
format(string, sizeof(string), "Polнtico %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 21)
{
format(string, sizeof(string), "Oficial BOPE %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 14)
{
format(string, sizeof(string), "Oficial PRF %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 3)
{
format(string, sizeof(string), "Forзas Armadas %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 24)
{
format(string, sizeof(string), "Bombeiro %s: %s", sendername, result);
}
else
{
format(string, sizeof(string), "Oficial %s: %s", sendername, result);
}
SendClientMessageToAll(COLOR_DBLUE, string);
}
return 1;
}
Re: [Ajuda] /gov tempo -
Cristhian - 15.10.2011
pawn Код:
new bool:gov[MAX_PLAYERS];
pawn Код:
SetTimerEx("ggov", 60000*3, false, "d", playerid);//coloque no comando!
pawn Код:
gov[playerid] = true;//coloque depois que a mensagem for enviada
pawn Код:
forward ggov(playerid);
public ggov(playerid)
{
if(gov[playerid])
{
gov[playerid] = false;
}
return 1;
}
Re: [Ajuda] /gov tempo -
iansinho - 15.10.2011
Isso ai que o Cristhian mandou!
Eu editei o comando caso vocк nгo soubesse e tambйm coloquei caso nгo estiver dado os 3 minutos vai mandar uma mensagem mandando ele aguardar 3 minutos.
Faзa isso:
Adicione no topo do seu GM:
PHP код:
new bool:gov[MAX_PLAYERS];
Substitua seu comando /governo por este aqui:
PHP код:
if(strcmp(cmd, "/governo", true) == 0 || strcmp(cmd, "/gov", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo й um policial !");
return 1;
}
if(gov[playerid] == true) // creditos ian
{
SendClientMessage(playerid, COLOR_GREY, " Vocк deve aguardar 3 minutos antes de mandar outro /gov(erno).");
return 1;
}
if(PlayerInfo[playerid][pRank] < 5)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк precisar ter cargo maior ou igual а 5 !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
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))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: (/gov)erno [texto]");
return 1;
}
SendClientMessageToAll(COLOR_WHITE, "|___________ Notнcias governamentais ___________|");
for(new luplay=0;luplay<6;luplay++){
if(strfind(result, IP[luplay], true) != -1){result = "PКGO EM FRБGRANTE!!!Jogador tentando divulgar algum IP.";}}
if(PlayerInfo[playerid][pMember] == 7)
{
format(string, sizeof(string), "Polнtico %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 21)
{
format(string, sizeof(string), "Oficial BOPE %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 14)
{
format(string, sizeof(string), "Oficial PRF %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 3)
{
format(string, sizeof(string), "Forзas Armadas %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 24)
{
format(string, sizeof(string), "Bombeiro %s: %s", sendername, result);
}
else
{
format(string, sizeof(string), "Oficial %s: %s", sendername, result);
}
SendClientMessageToAll(COLOR_DBLUE, string);
gov[playerid] = true;//Creditos a Cristhian
SetTimerEx("ggov", 60000*3, false, "d", playerid);//Creditos a Cristhian
}
return 1;
}
No final do GM adicione:
PHP код:
forward ggov(playerid);
public ggov(playerid)
{
if(gov[playerid])
{
gov[playerid] = false;
}
return 1;
}
FLW Boa sorte.
Re: [Ajuda] /gov tempo -
Lуs - 15.10.2011
pawn Код:
new bool:Anunciado[MAX_PLAYERS];
forward Desanunciar(playerid);
if(strcmp(cmd, "/governo", true) == 0 || strcmp(cmd, "/gov", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(Anunciado(playerid)) return SendClientMessage(playerid, COLOR_GREY, " Aguarde 3 minutos para anunciar novamente!");
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo й um policial !");
return 1;
}
if(PlayerInfo[playerid][pRank] < 5)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк precisar ter cargo maior ou igual а 5 !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
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))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: (/gov)erno [texto]");
return 1;
}
SendClientMessageToAll(COLOR_WHITE, "|___________ Notнcias governamentais ___________|");
for(new luplay=0;luplay<6;luplay++){
if(strfind(result, IP[luplay], true) != -1){result = "PКGO EM FRБGRANTE!!!Jogador tentando divulgar algum IP.";}}
if(PlayerInfo[playerid][pMember] == 7)
{
format(string, sizeof(string), "Polнtico %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 21)
{
format(string, sizeof(string), "Oficial BOPE %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 14)
{
format(string, sizeof(string), "Oficial PRF %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 3)
{
format(string, sizeof(string), "Forзas Armadas %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 24)
{
format(string, sizeof(string), "Bombeiro %s: %s", sendername, result);
}
else
{
format(string, sizeof(string), "Oficial %s: %s", sendername, result);
}
SendClientMessageToAll(COLOR_DBLUE, string);
Anunciado[playerid] = true;
SetTimer("Desanunciar", 60000*3, false);
}
return 1;
}
public Desanunciar(playerid)
{
Anunciado[playerid] = false;
SendClientMessage(playerid, -1, "Vocк jб pode anunciar novamente!");
return 1;
}
Re: [Ajuda] /gov tempo -
Cristhian - 15.10.2011
pawn Код:
if(strcmp(cmd, "/governo", true) == 0 || strcmp(cmd, "/gov", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo й um policial !");
return 1;
}
if(gov[playerid]) return SendClientMessage(playerid, COLOR_GREY, " Vocк deve aguardar 3 minutos antes de mandar outro /gov(erno)."); // creditos ian, sу simplifiquei..
if(PlayerInfo[playerid][pRank] < 5)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк precisar ter cargo maior ou igual а 5 !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
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))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: (/gov)erno [texto]");
return 1;
}
SendClientMessageToAll(COLOR_WHITE, "|___________ Notнcias governamentais ___________|");
for(new luplay=0;luplay<6;luplay++){
if(strfind(result, IP[luplay], true) != -1){result = "PКGO EM FRБGRANTE!!!Jogador tentando divulgar algum IP.";}}
if(PlayerInfo[playerid][pMember] == 7)
{
format(string, sizeof(string), "Polнtico %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 21)
{
format(string, sizeof(string), "Oficial BOPE %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 14)
{
format(string, sizeof(string), "Oficial PRF %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 3)
{
format(string, sizeof(string), "Forзas Armadas %s: %s", sendername, result);
}
else if(PlayerInfo[playerid][pMember] == 24)
{
format(string, sizeof(string), "Bombeiro %s: %s", sendername, result);
}
else
{
format(string, sizeof(string), "Oficial %s: %s", sendername, result);
}
SendClientMessageToAll(COLOR_DBLUE, string);
gov[playerid] = true;//Creditos a Cristhian
SetTimerEx("ggov", 60000*3, false, "d", playerid);//Creditos a Cristhian
}
return 1;
}
diminui umas 3 linhas o cod...