SA-MP Forums Archive
anytime I hit /aduty my server crashes -_- - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: anytime I hit /aduty my server crashes -_- (/showthread.php?tid=452999)



anytime I hit /aduty my server crashes -_- - skaman44 - 23.07.2013

So pretty much I load my server and then if I go to hit /aduty it crashes, it didn't do it until I added the setplayername(playerid, playerinfo[playerid][pAdminName]. Idk why it does so if anybody could help me out


So here is the aduty command:

Код:
CMD:aduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, "This is an admin only command!");
	if(PlayerInfo[playerid][pAdminDuty] == 0)
	{

		SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on administrative duty!");
		SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]); //and I just added this for the /setadminname command and it crashes my server anytime that I try to do /aduty.
		SetPlayerColor(playerid, COLOR_RED);
		PlayerInfo[playerid][pAdminDuty] = 1;
		SetPlayerHealth(playerid, 100000);
		SetPlayerArmour(playerid, 100000);
		//SetPlayerSkin(playerid, 294);
		new string[128];
		format(string, sizeof(string), "{FFFFFF}(( {00FFC4}%s has just entered admin {FF0000}mode! {FFFFFF}({0009FF}/report{FFFFFF} for assistance) ))", GetPlayerNameEx(playerid));
		SendClientMessageToAllEx(COLOR_YELLOW, string);
	}
	else
	{
			SendClientMessageEx(playerid, COLOR_RED, "You are now off admin duty!");
			SetPlayerName(playerid, PlayerInfo[playerid][pNormalName]);
            SetPlayerColor(playerid, COLOR_WHITE);
			SetPlayerHealth(playerid, 100);
			SetPlayerArmour(playerid, 0);
			//SetPlayerSkin(playerid, 299); - Commented by Voltage
			PlayerInfo[playerid][pAdminDuty] = 0;
	}
    return 1;
}
Here's the setadminname command:

Код:
CMD:setadminname(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128], newname[24];
        if(sscanf(params, "s", newname)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setadminanme <name>");
        PlayerInfo[playerid][pAdminName] = newname;
        format(string, sizeof(string), "You set your admin name to %s", newname);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "You are not authorized to use this command!");
    return 1;
}
I have no idea why it does it, I'm still kinda new to the whole coding thing.


Re: anytime I hit /aduty my server crashes -_- - Blessed - 23.07.2013

It's a lot easier to read if you use [ CODE][ /CODE]