HELP RESTART SERVER
#1

Hello, i have problem when any admin is make /spec , and he /slap players, server is restart auto



Code:
pawn Код:
CMD:slap(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You need to login first.");
    if(IsPlayerConnected(playerid))
    {
        if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
        {
            new string[64],giveplayer[25],sendername[25],id;
            if(sscanf(params, "u",id)) return SCM(playerid,0xCECECEFF, "Syntax:{FFFFFF} /slap <Name/Playerid>");
            new Float:shealth;
            new Float:slx, Float:sly, Float:slz;
            if(IsPlayerConnected(id))
            {
                GetPlayerName(id, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerHealthEx(id, shealth);
                SetPlayerHealthEx(id, shealth-5);
                GetPlayerPos(id, slx, sly, slz);
                SetPlayerPos(id, slx, sly, slz+5);
                format(string, 256, "{FF0000}AdmInfo: {FFFFFF}Admin/Helper %s slap %s.", sendername,giveplayer);
                ABroadCast(COLOR_WHITE,string,1);
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
            }
        }
        else return SendClientMessage(playerid, COLOR_WHITE,"{5CAD5C}Error: Your admin/helper");
    }
    return 1;
}
Reply
#2

Hello!

What says the crashdetect plugin?
Reply
#3

give us the /spec command
Reply
#4

i don't use crashdetect.
pawn Код:
CMD:spec(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You need to login first.");
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 1)
        {
            new id,giveplayer[25],string[100];
            if(sscanf(params, "u", id)) return SCM(playerid,COLOR_WHITE,"Syntax:{FFFFFF} /spec <Name/Playerid>");
            {
                if(IsPlayerConnected(id))
                {
                    if(id != INVALID_PLAYER_ID)
                    {
                        Spectate[playerid] = id;
                        new Float:health;
                        new playersip[180];
                        GetPlayerHealthEx(Spectate[playerid], health);
                        GetPlayerIp(Spectate[playerid],playersip,sizeof(playersip));
                        GetPlayerName(Spectate[playerid], giveplayer, sizeof(giveplayer));
                        format(string, sizeof(string), "- Player Info: Name: %s | Heal: %.2f | Location: %s | IP: %s | Level: %d | Wanted: %d -",giveplayer,health,GetPlayerZone(playerid),playersip,PlayerInfo[playerid][pLevel],PlayerInfo[playerid][pWantedLevel]);
                        SendClientMessage(playerid, COLOR_IN2, string);
                        TogglePlayerSpectating(playerid, 1);
                        if(IsPlayerInAnyVehicle(Spectate[playerid]))
                        {
                            new carid = GetPlayerVehicleID(Spectate[playerid]);
                            PlayerSpectateVehicle(playerid, carid);
                        }
                        else
                        {
                            PlayerSpectatePlayer(playerid, Spectate[playerid]);
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
            return 1;
        }
    }
    return 1;
}
Reply
#5

Why did the sever crash?
Open you server log and tell us what the server told before crashing.

Install Crashdetect Plugin and add pawn.cfg with the contents "-d3" in your pawno folder.
Recompile you script and then crash your server.We will get more information.Even the line in your code which crashed the server.
Reply
#6

pawn Код:
new string[64],giveplayer[25],sendername[25],id;
...
format(string, 256, "{FF0000}AdmInfo: {FFFFFF}Admin/Helper %s slap %s.", sendername,giveplayer);
string has size of 64 and you use 256 in format.
Reply
#7

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Why did the sever crash?
Open you server log and tell us what the server told before crashing.

Install Crashdetect Plugin and add pawn.cfg with the contents "-d3" in your pawno folder.
Recompile you script and then crash your server.We will get more information.Even the line in your code which crashed the server.
and me how i know it in /slap ? :3 i checked logs when admin make /slap , srv restart is 2 times [in /slap ]

ok, will try it about crashdetect

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
new string[64],giveplayer[25],sendername[25],id;
...
format(string, 256, "{FF0000}AdmInfo: {FFFFFF}Admin/Helper %s slap %s.", sendername,giveplayer);
string has size of 64 and you use 256 in format.
Explique more , ok will make "new string[256] ?
Reply
#8

Max client message can be sent is 144 characters and your text is even less than that so keep:
pawn Код:
new string[64], ...
...
format(string, 64, ...
and use 64 or even "sizeof (string)".
Reply
#9

CMDlap(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >=2)
{
new string[128], giveplayerid;
if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");

new Floathealth;
new Floatlx, Floatly, Floatlz;

if(IsPlayerConnected(giveplayerid))
{

GetPlayerHealth(giveplayerid, shealth);
SetPlayerHealth(giveplayerid, shealth-5);
GetPlayerPos(giveplayerid, slx, sly, slz);
SetPlayerPos(giveplayerid, slx, sly, slz+5);
PlayerPlaySound(giveplayerid, 1130, slx, sly, slz+5);
format(string, sizeof(string), "AdmCmd: %s was slapped by %s",GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);

}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}


CMDpec(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}

new tmp[32];
if(sscanf(params, "s[32]", tmp)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /spec (playerid/off)");

if(strcmp("off", tmp, true, strlen(tmp)) == 0)
{
if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 1)
{
GettingSpectated[Spectate[playerid]] = 999;
Spectating[playerid] = 0;
Spectate[playerid] = 999;
SetPVarInt(playerid, "SpecState", -1);
SetPVarInt(playerid, "SpecOff", 1 );
TogglePlayerSpectating( playerid, false );
TogglePlayerBurning(playerid, false);
SetCameraBehindPlayer(playerid);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not spectating anyone.");
return 1;
}
}
new giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new string[128];
if( InsideTut[giveplayerid] >= 1 )
{
SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: This player is in the tutorial. Please consider this before assuming that they're air-breaking.");
}
if(GetPVarInt(giveplayerid, "IsInArena") >= 0) SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: This player is in paintball. Ensure they haven't stepped out of the boundaries before assuming they are airbreaking.");
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin]) { format(string, sizeof(string), "NOTE: A lower level administrator (%s) is now spectating you.", GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_WHITE, string); }
if(Spectating[playerid] == 0)
{
new Float: pPositions[ 3 ];
GetPlayerPos(playerid, pPositions[ 0 ], pPositions[ 1 ], pPositions[ 2 ]);
SetPVarFloat(playerid, "SpecPosX", pPositions[ 0 ]);
SetPVarFloat(playerid, "SpecPosY", pPositions[ 1 ]);
SetPVarFloat(playerid, "SpecPosZ", pPositions[ 2 ]);
SetPVarInt(playerid, "SpecInt", GetPlayerInterior(playerid));
SetPVarInt(playerid, "SpecVW", GetPlayerVirtualWorld(playerid));
//SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
if(IsPlayerInAnyVehicle(giveplayerid))
{
TogglePlayerSpectating(playerid, true);
new carid = GetPlayerVehicleID( giveplayerid );
PlayerSpectateVehicle( playerid, carid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
else
{
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer( playerid, giveplayerid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
GettingSpectated[giveplayerid] = playerid;
Spectate[playerid] = giveplayerid;
Spectating[playerid] = 1;
SendClientMessageEx(playerid, COLOR_GRAD3, "HINT: Type /showcmds to see what the player is typing");
}
else
{
if(IsPlayerInAnyVehicle(giveplayerid))
{
TogglePlayerSpectating(playerid, true);
new carid = GetPlayerVehicleID( giveplayerid );
PlayerSpectateVehicle( playerid, carid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
else
{
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer( playerid, giveplayerid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
GettingSpectated[Spectate[playerid]] = 999;
GettingSpectated[giveplayerid] = playerid;
Spectate[playerid] = giveplayerid;
Spectating[playerid] = 1;
}
format(STRING, "%s spectated %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
Log("logs/spec.log", string);

}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "Target is not available.");
}
return 1;
}


This code will help you .
Reply
#10

Quote:
Originally Posted by SoFahim
Посмотреть сообщение
CMDlap(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >=2)
{
new string[128], giveplayerid;
if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /slap [playerid]");

new Floathealth;
new Floatlx, Floatly, Floatlz;

if(IsPlayerConnected(giveplayerid))
{

GetPlayerHealth(giveplayerid, shealth);
SetPlayerHealth(giveplayerid, shealth-5);
GetPlayerPos(giveplayerid, slx, sly, slz);
SetPlayerPos(giveplayerid, slx, sly, slz+5);
PlayerPlaySound(giveplayerid, 1130, slx, sly, slz+5);
format(string, sizeof(string), "AdmCmd: %s was slapped by %s",GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid));
ABroadCast(COLOR_LIGHTRED,string,2);

}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}


CMDpec(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}

new tmp[32];
if(sscanf(params, "s[32]", tmp)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /spec (playerid/off)");

if(strcmp("off", tmp, true, strlen(tmp)) == 0)
{
if(Spectating[playerid] > 0 && PlayerInfo[playerid][pAdmin] >= 1)
{
GettingSpectated[Spectate[playerid]] = 999;
Spectating[playerid] = 0;
Spectate[playerid] = 999;
SetPVarInt(playerid, "SpecState", -1);
SetPVarInt(playerid, "SpecOff", 1 );
TogglePlayerSpectating( playerid, false );
TogglePlayerBurning(playerid, false);
SetCameraBehindPlayer(playerid);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not spectating anyone.");
return 1;
}
}
new giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new string[128];
if( InsideTut[giveplayerid] >= 1 )
{
SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: This player is in the tutorial. Please consider this before assuming that they're air-breaking.");
}
if(GetPVarInt(giveplayerid, "IsInArena") >= 0) SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: This player is in paintball. Ensure they haven't stepped out of the boundaries before assuming they are airbreaking.");
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin]) { format(string, sizeof(string), "NOTE: A lower level administrator (%s) is now spectating you.", GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_WHITE, string); }
if(Spectating[playerid] == 0)
{
new Float: pPositions[ 3 ];
GetPlayerPos(playerid, pPositions[ 0 ], pPositions[ 1 ], pPositions[ 2 ]);
SetPVarFloat(playerid, "SpecPosX", pPositions[ 0 ]);
SetPVarFloat(playerid, "SpecPosY", pPositions[ 1 ]);
SetPVarFloat(playerid, "SpecPosZ", pPositions[ 2 ]);
SetPVarInt(playerid, "SpecInt", GetPlayerInterior(playerid));
SetPVarInt(playerid, "SpecVW", GetPlayerVirtualWorld(playerid));
//SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
if(IsPlayerInAnyVehicle(giveplayerid))
{
TogglePlayerSpectating(playerid, true);
new carid = GetPlayerVehicleID( giveplayerid );
PlayerSpectateVehicle( playerid, carid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
else
{
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer( playerid, giveplayerid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
GettingSpectated[giveplayerid] = playerid;
Spectate[playerid] = giveplayerid;
Spectating[playerid] = 1;
SendClientMessageEx(playerid, COLOR_GRAD3, "HINT: Type /showcmds to see what the player is typing");
}
else
{
if(IsPlayerInAnyVehicle(giveplayerid))
{
TogglePlayerSpectating(playerid, true);
new carid = GetPlayerVehicleID( giveplayerid );
PlayerSpectateVehicle( playerid, carid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
else
{
TogglePlayerSpectating(playerid, true);
PlayerSpectatePlayer( playerid, giveplayerid );
SetPlayerInterior( playerid, GetPlayerInterior( giveplayerid ) );
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( giveplayerid ) );
SetPVarInt(playerid, "SpecState", GetPlayerState(giveplayerid));
}
GettingSpectated[Spectate[playerid]] = 999;
GettingSpectated[giveplayerid] = playerid;
Spectate[playerid] = giveplayerid;
Spectating[playerid] = 1;
}
format(STRING, "%s spectated %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
Log("logs/spec.log", string);

}
}
else
{
SendClientMessageEx(playerid, COLOR_WHITE, "Target is not available.");
}
return 1;
}


This code will help you .
use [code] tags please.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)