All logs and crash server with /pay
#1

Hi, i have two problems, first: i want to see all logs, what server do, in server_log is only ready results, because something crashesh server.

Second problem is not working /pay, when i use this crash me and this men who i pay.

Код:
    if(strcmp(cmd, "/pay", true) == 0 || strcmp(cmd, "/plac", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(PlayerInfo[playerid][pConnectTime] < 2)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "Musisz byc co najmniej 2 godziny aby dostac wyplate");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "{33CCFF}Wpisz:{FFFFFF} /plac [ID/CzescNicku] [ilosc]");
				return 1;
			}
			//giveplayerid = strval(tmp);
	        giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "{33CCFF}Wpisz:{FFFFFF} /plac [ID/CzescNicku] [ilosc]");
				return 1;
			}
			moneys = strval(tmp);
			if(moneys > 1000 && PlayerInfo[playerid][pConnectTime] < 8)
			{
				SendClientMessage(playerid, COLOR_GREY, "  Musisz miec co najmniej 8 godzin gry, aby dac wiecej niz 1000!");
				return 1;
			}
			if(moneys < 1 || moneys > 99999)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "Nie mozesz ponizej 1 lub powyzej 99999 na raz.");
			    return 1;
			}
			if (IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        if(PlayerInfo[giveplayerid][pLocal] == 106)
					{
						SendClientMessage(playerid, COLOR_GRAD1, "Polecenie niedozwolone w tej lokalizacji");
						return 1;
					}
					if (ProxDetectorS(5.0, playerid, giveplayerid))
					{
					    if(giveplayerid == playerid)
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   Nie mozna placic za siebie !");
					        return 1;
					    }
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        //GetPlayerName(playerid, sendername, sizeof(sendername));
						playermoney = GetCash(playerid);
						if (moneys > 0 && playermoney >= moneys)
						{
						    //ConsumingMoney[giveplayerid] = 1;
							GiveCash(playerid, (0 - moneys));
							GiveCash(giveplayerid, moneys);
							format(string, sizeof(string), "   Wyslano %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							SendClientMessage(playerid, COLOR_GRAD1, string);
							format(string, sizeof(string), "   Odebrano $%d from %s(player: %d).", moneys, sendername, playerid);
							SendClientMessage(giveplayerid, COLOR_GRAD1, string);
							format(string, sizeof(string), "%s zaplacil $%d to %s", sendername, moneys, giveplayer);
							PayLog(string);
							if(moneys >= 1000000)
							{
								ABroadCast(COLOR_YELLOW,string,1);
							}
							PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
							format(string, sizeof(string), "* %s podaje troche gotowki do %s.", sendername ,giveplayer);
							ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							ApplyAnimation(playerid,"Sprzedawca","sklep_zaplata",4.1,0,0,0,0,0);
						}
						else
						{
							SendClientMessage(playerid, COLOR_GRAD1, "   Nieprawidlowa kwota transakcji.");
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "   Jestes za daleko.");
					}
				}//invalid id
			}
			else
			{
				format(string, sizeof(string), "   %d nie jest aktywnym graczem.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Sorry for my bad English.
Reply
#2

Add this at OnPlayerCommandText for the logs.

PHP код:
new plname[MAX_PLAYER_NAME];
GetPlayerName(playeridplnamesizeof(plname));
printf("[cmd][%s]: %s",plname,cmdtext); 
Reply
#3

Ok, thanks, i paste this, maybe it help, but i wont something else, becouse meube server dont crash for the cmd's when player write this, but maybe its it.

But i have second problem
Reply
#4

Sorry, You script is not working ;x
Reply
#5

Debug your command the find where the code stop.
Reply
#6

What i can do that?
Reply
#7

pawn Код:
if(strcmp(cmd, "/pay", true) == 0 || strcmp(cmd, "/plac", true) == 0)
    {
        new count;
        if(IsPlayerConnected(playerid))
        {
            printf("%d",count++);
            if(PlayerInfo[playerid][pConnectTime] < 2)
            {
                printf("%d",count++);
                SendClientMessage(playerid, COLOR_GRAD1, "Musisz byc co najmniej 2 godziny aby dostac wyplate");
                return 1;
            }
            printf("%d",count++);
            tmp = strtok(cmdtext, idx);
            printf("%d",count++);
            if(!strlen(tmp))
            {
                printf("%d",count++);
                SendClientMessage(playerid, COLOR_GRAD1, "{33CCFF}Wpisz:{FFFFFF} /plac [ID/CzescNicku] [ilosc]");
                return 1;
            }
            //giveplayerid = strval(tmp);
            printf("%d",count++);
            giveplayerid = ReturnUser(tmp);
            printf("%d",count++);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                printf("%d",count++);
                SendClientMessage(playerid, COLOR_GRAD1, "{33CCFF}Wpisz:{FFFFFF} /plac [ID/CzescNicku] [ilosc]");
                return 1;
            }
            printf("%d",count++);
            moneys = strval(tmp);
            if(moneys > 1000 && PlayerInfo[playerid][pConnectTime] < 8)
            {
                printf("%d",count++);
                SendClientMessage(playerid, COLOR_GREY, "  Musisz miec co najmniej 8 godzin gry, aby dac wiecej niz 1000!");
                return 1;
            }
            if(moneys < 1 || moneys > 99999)
            {
                printf("%d",count++);
                SendClientMessage(playerid, COLOR_GRAD1, "Nie mozesz ponizej 1 lub powyzej 99999 na raz.");
                return 1;
            }
            if (IsPlayerConnected(giveplayerid))
            {
                printf("%d",count++);
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    printf("%d",count++);
                    if(PlayerInfo[giveplayerid][pLocal] == 106)
                    {
                        printf("%d",count++);
                        SendClientMessage(playerid, COLOR_GRAD1, "Polecenie niedozwolone w tej lokalizacji");
                        return 1;
                    }
                    if (ProxDetectorS(5.0, playerid, giveplayerid))
                    {
                        printf("%d",count++);
                        if(giveplayerid == playerid)
                        {
                            printf("%d",count++);
                            SendClientMessage(playerid, COLOR_GREY, "   Nie mozna placic za siebie !");
                            return 1;
                        }
                            printf("%d",count++);
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        //GetPlayerName(playerid, sendername, sizeof(sendername));
                        printf("%d",count++);
                        playermoney = GetCash(playerid);
                        if (moneys > 0 && playermoney >= moneys)
                        {
                            printf("%d",count++);
                            //ConsumingMoney[giveplayerid] = 1;
                            GiveCash(playerid, (0 - moneys));printf("%d",count++);
                            GiveCash(giveplayerid, moneys);printf("%d",count++);
                            format(string, sizeof(string), "   Wyslano %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);printf("%d",count++);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);printf("%d",count++);
                            SendClientMessage(playerid, COLOR_GRAD1, string);printf("%d",count++);
                            format(string, sizeof(string), "   Odebrano $%d from %s(player: %d).", moneys, sendername, playerid);printf("%d",count++);
                            SendClientMessage(giveplayerid, COLOR_GRAD1, string);printf("%d",count++);
                            format(string, sizeof(string), "%s zaplacil $%d to %s", sendername, moneys, giveplayer);printf("%d",count++);
                            PayLog(string);printf("%d",count++);
                            if(moneys >= 1000000)
                            {
                                printf("%d",count++);
                                ABroadCast(COLOR_YELLOW,string,1);
                            }
                            PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);printf("%d",count++);
                            format(string, sizeof(string), "* %s podaje troche gotowki do %s.", sendername ,giveplayer);printf("%d",count++);
                            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);printf("%d",count++);
                            ApplyAnimation(playerid,"Sprzedawca","sklep_zaplata",4.1,0,0,0,0,0);printf("%d",count++);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "   Nieprawidlowa kwota transakcji.");printf("%d",count++);
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "   Jestes za daleko.");
                    }
                }//invalid id
            }
            else
            {
                format(string, sizeof(string), "   %d nie jest aktywnym graczem.", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
Crash your server and post here your server_log.txt
Reply
#8

I repair this command, but i want to secure server for crash by advenced logs etc. Becouse when server crash i have info about crashes script/function etc.
Reply
#9

Quote:
Originally Posted by ToFFiK
Посмотреть сообщение
I repair this command, but i want to secure server for crash by advenced logs etc. Becouse when server crash i have info about crashes script/function etc.
What do you mean? You want crash detector? Search it in plugin section.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)