02.03.2013, 20:27
Bom pessoal,vocкs sabem aqueles comandos de servidor rpg tipo /usardrogas maconha? pois й nй? o player tem que digitar toda hora isso pra encher o colete,vendo isso eu pensei em altomatizar o sistema entгo oque eu fiz...criei settimers... porйm esses settimers tгo bugando e nгo param...e ainda acontece de quando o player logar o settimer ativar sem nada,fazendo o player ser kikado por flood de comando
bom vamos ao code:
Como se pode ver a cada nome ele ativa um settimer...
agora veja as publics dos settimers:
agora veja os comandos das publics:
como pode ver... quando nгo hб mais drogas ele para o timer...
agora oque estб acontecendo й o seguinte:
1- ele flooda essas mensagens:
Vocк nгo tem mais LSDs!
* %s esta alucinado com LSD!
2- se vc tenta dar /usardrogas (lsd,heroina ou cogumelos)
ele diz que o player estб usando a droga mais ele nгo enche nem 1 de colete,apenas coloca o bubblechat por 1 segundo e some o bubble...
3- o estranho й que...quando os players logam o sv flooda aquelas mensagens APENAS DO LSD! fazendo o player ser kikado por flood de comando,sendo que o player nem deu /usardrogas e se ele da o cmd num funfa...
4- outra coisa estranha й... DE VEZ ENQUANDO o cmd funfa o servidor offline,apenas comigo online... oq fazer?
bom vamos ao code:
pawn Код:
if(strcmp(cmd,"/usardrogas",true)==0)
{
if(IsPlayerConnected(playerid) && admtrampando[playerid] == 0)
{
new x_Emprego[32];
x_Emprego = strtok(cmdtext, idx);
if(!strlen(x_Emprego))
{
SendClientMessage(playerid, COLOR_WHITE, "|______________[ Use Drogas ]______________|");
SendClientMessage(playerid, COLOR_GRAD1,"USE: /usardrogas lsd");
SendClientMessage(playerid, COLOR_GRAD1,"USE: /usardrogas cogumelos");
SendClientMessage(playerid, COLOR_GRAD1,"USE: /usardrogas heroina");
return true;
}
if(strcmp(x_Emprego,"lsd",true) == 0)
{
if(PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_YELLOW," Vocк nгo pode usar drogas na cadeia!");
return true;
}
if(IsPlayerConnected(playerid))
{
mamonheiro = SetTimer("saladamaconha",500,true);
ApplyAnimation(playerid,"FOOD","EAT_Chicken",4.1,0,1,1,1,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб utilizando LSD!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"*Usando LSD*", 0xFF0000FF, 20.0, 999);
}//not connected
return true;
}
else if(strcmp(x_Emprego,"heroina",true) == 0)
{
if(PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_YELLOW," Vocк nгo usar drogas na cadeia!");
return true;
}
if(IsPlayerConnected(playerid))
{
heroineiro = SetTimer("saladacocaina",500,true);
ApplyAnimation(playerid,"COLT45","colt45_fire_2hands",4.1,0,1,1,1,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб utilizando Heroina!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"*Usando Heroina*", 0xFF0000FF, 20.0, 999);
}//not connected
return true;
}
else if(strcmp(x_Emprego,"cogumelos",true) == 0)
{
if(PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_YELLOW," Vocк nгo pode usar drogas na cadeia!");
return true;
}
if(IsPlayerConnected(playerid))
{
crackeiro = SetTimer("saladacrack",500,true);
ApplyAnimation(playerid,"FOOD","EAT_Chicken",4.1,0,1,1,1,1);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб comendo Cogumelos!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"*Comendo Cogumelos*", 0xFF0000FF, 20.0, 999);
PlayAudioStreamForPlayer(playerid, "http://dc651.4shared.com/img/3399722327/d20d11f0/dlink__2Fdownload_2Fhz7KBdFe_3Ftsid_3D20130227-202659-cb84852_26dsid_3D5822th.341162c375532f3bb81fa28e68e496cc/preview.mp3");
}//not connected
return true;
}
}
}
agora veja as publics dos settimers:
pawn Код:
forward saladamaconha(playerid);
public saladamaconha(playerid) {
OnPlayerCommandText(playerid,"/saladamistamaconha");
return true;
}
forward saladacocaina(playerid);
public saladacocaina(playerid) {
OnPlayerCommandText(playerid,"/saladamistacocaina");
return true;
}
forward saladacrack(playerid);
public saladacrack(playerid) {
OnPlayerCommandText(playerid,"/saladamistacrack");
return true;
}
pawn Код:
if(strcmp(cmd, "/saladamistamaconha", true) == 0)
{
if(PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_YELLOW," Vocк nгo pode usar drogas na cadeia!");
return true;
}
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pDorgado] >= 5000 && PlayerInfo[playerid][pVIP] <= 3)
{
PlayerInfo[playerid][pDoenca] = 5;
PlayerInfo[playerid][pDorgado] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Vocк sofreu uma overdose por LSD!");
SetPlayerHealth_pB(playerid,0);
return true;
}
if(PlayerInfo[playerid][pDoenca] == 5)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s sofreu uma overdose por LSD!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return true;
}
if(PlayerBoxing[playerid] > 0 || PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_GREY,"Vocк nгo pode usar Drogas enquanto vocк estб lutando !");
return true;
}
if(PlayerInfo[playerid][pDrogas] > 1)
{
if(PlayerStoned[playerid] >= 3)
{
GameTextForPlayer(playerid,"~w~Vocк esta~n~~p~Noiado!",4000,1);
}
new Float:PlayersArmour;
GetPlayerArmour(playerid,PlayersArmour);
PlayerInfo[playerid][pDrogas] -= 2;
PlayerInfo[playerid][pDorgado] += 2;
new Dmelhoria = 1 * PlayerInfo[playerid][pDrugPerk]; Dmelhoria += 2;
if(PlayersArmour >= 100)
{
SetPlayerArmour_pB(playerid, 100);
KillTimer(mamonheiro);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Vocк acabou de usar suas LSDs!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s esta alucinado com LSD!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"", 0xFF0000FF, 20.0, 999);
ClearAnimations(playerid);
ClearAnimations(playerid);
return true;
}
else
{
SetPlayerArmour_pB(playerid, PlayersArmour + Dmelhoria);
}
}
else
{
KillTimer(mamonheiro);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Vocк nгo tem mais LSDs!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s nгo possui mais LSD!", PlayerName(playerid));
KillTimer(mamonheiro);
KillTimer(mamonheiro);
KillTimer(mamonheiro);
KillTimer(mamonheiro);
KillTimer(mamonheiro);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"", 0xFF0000FF, 20.0, 999);
ClearAnimations(playerid);
ClearAnimations(playerid);
}
}//not connected
return true;
}
if(strcmp(cmd, "/saladamistacocaina", true) == 0)
{
if(PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_YELLOW," Vocк nгo usar drogas na cadeia!");
return true;
}
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pDorgado] >= 5000)
{
PlayerInfo[playerid][pDoenca] = 5;
PlayerInfo[playerid][pDorgado] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Vocк sofreu uma overdose por Heroina!!");
SetPlayerHealth_pB(playerid,0);
return true;
}
if(PlayerInfo[playerid][pDoenca] == 5)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s sofreu uma overdose por Heroina!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return true;
}
if(PlayerBoxing[playerid] > 0 || PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_GREY,"Vocк nгo pode usar drogas enquanto estб lutando !");
return true;
}
if(PlayerInfo[playerid][pDrogas2] > 1)
{
PlayerStoned[playerid] += 1;
if(PlayerStoned[playerid] >= 3)
{
GameTextForPlayer(playerid,"~w~Voce esta~n~~r~Euforico!",4000,1);
}
new Float:PlayersArmour;
GetPlayerArmour(playerid,PlayersArmour);
PlayerInfo[playerid][pDrogas2] -= 2;
PlayerInfo[playerid][pDorgado] += 2;
new Dmelhoria = 1 * PlayerInfo[playerid][pDrugPerk]; Dmelhoria += 2;
if(PlayersArmour >= 100)
{
SetPlayerArmour_pB(playerid, 100);
KillTimer(heroineiro);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Vocк acabou de usar suas Heroinas!!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб eufуrico com Heroina!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"", 0xFF0000FF, 20.0, 999);
ClearAnimations(playerid);
ClearAnimations(playerid);
return true;
}
else
{
SetPlayerArmour_pB(playerid, PlayersArmour + Dmelhoria);
}
}
else
{
KillTimer(heroineiro);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Vocк nгo tem mais Heroina!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s nгo possui mais Heroina!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"", 0xFF0000FF, 20.0, 999);
ClearAnimations(playerid);
ClearAnimations(playerid);
}
}//not connected
return true;
}
if(strcmp(cmd, "/saladamistacrack", true) == 0)
{
if(PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_YELLOW," Vocк nгo usar drogas na cadeia!");
return true;
}
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pDorgado] >= 5000)
{
PlayerInfo[playerid][pDoenca] = 5;
PlayerInfo[playerid][pDorgado] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Vocк sofreu uma overdose por Cogumelos!!");
SetPlayerHealth_pB(playerid,0);
return true;
}
if(PlayerInfo[playerid][pDoenca] == 5)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s sofreu uma overdose por Heroina!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return true;
}
if(PlayerBoxing[playerid] > 0 || PlayerInfo[playerid][pJailed] != 0)
{
SendClientMessage(playerid,COLOR_GREY,"Vocк nгo pode usar drogas enquanto estб lutando !");
return true;
}
if(PlayerInfo[playerid][pDrogas3] > 1)
{
PlayerStoned[playerid] += 1;
if(PlayerStoned[playerid] >= 3)
{
GameTextForPlayer(playerid,"~w~Voce esta~n~~b~vendo gnomos!",4000,1);
}
new Float:PlayersArmour;
GetPlayerArmour(playerid,PlayersArmour);
PlayerInfo[playerid][pDrogas3] -= 2;
PlayerInfo[playerid][pDorgado] += 2;
new Dmelhoria = 1 * PlayerInfo[playerid][pDrugPerk]; Dmelhoria += 2;
if(PlayersArmour >= 100)
{
SetPlayerArmour_pB(playerid, 100);
KillTimer(crackeiro);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Vocк acabou de usar seus Cogumelos!!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s estб vendo gnomos com Cogumelos!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"", 0xFF0000FF, 20.0, 999);
ClearAnimations(playerid);
ClearAnimations(playerid);
return true;
}
else
{
SetPlayerArmour_pB(playerid, PlayersArmour + Dmelhoria);
}
}
else
{
KillTimer(crackeiro);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"Vocк nгo tem mais Cogumelos!");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s nгo possui mais Cogumelos!", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerChatBubble(playerid,"", 0xFF0000FF, 20.0, 999);
ClearAnimations(playerid);
ClearAnimations(playerid);
}
}//not connected
return true;
}
agora oque estб acontecendo й o seguinte:
1- ele flooda essas mensagens:
Vocк nгo tem mais LSDs!
* %s esta alucinado com LSD!
2- se vc tenta dar /usardrogas (lsd,heroina ou cogumelos)
ele diz que o player estб usando a droga mais ele nгo enche nem 1 de colete,apenas coloca o bubblechat por 1 segundo e some o bubble...
3- o estranho й que...quando os players logam o sv flooda aquelas mensagens APENAS DO LSD! fazendo o player ser kikado por flood de comando,sendo que o player nem deu /usardrogas e se ele da o cmd num funfa...
4- outra coisa estranha й... DE VEZ ENQUANDO o cmd funfa o servidor offline,apenas comigo online... oq fazer?