*** Terrible Title Removed
#1

My do it automatically closes my samp-server.exe when i use the following cmd
Код:
CMD:aduty(playerid, params[])
{
	new string[128], file[32];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(!aDuty[playerid])
	{
		format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
		format(file, sizeof(file), "users/%s.ini", dini_Get(file, "AdminName"));
    	if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Choose an admin name using /aname first.");
    	format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
        format(string, sizeof(string), "AdmCmd: %s has went on admin duty. (Admin name: %s)", RPN(playerid), dini_Get(file, "AdminName"));
		SendAdminMessage(COLOR_DARKRED, 1, string);
		SaveChar(playerid);
		ClearChar(playerid);
		format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
		SetPlayerName(playerid, dini_Get(file, "AdminName"));
		LoadChar(playerid);
		aDuty[playerid] = 1;
		SpawnChar(playerid);
	    GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 16);
	    format(string, sizeof(string), "%s", RPALN(playerid));
	    /*Delete3DTextLabel(aDutyText[playerid]);
	    if(PlayerInfo[playerid][pAdmin] == 1) aDutyText[playerid] = Create3DTextLabel(string, COLOR_LIGHTGREEN, 0, 0, -20, 25, -1, 1);
	    if(PlayerInfo[playerid][pAdmin] == 2) aDutyText[playerid] = Create3DTextLabel(string, COLOR_LIME, 0, 0, -20, 25, -1, 1);
	    if(PlayerInfo[playerid][pAdmin] == 3) aDutyText[playerid] = Create3DTextLabel(string, COLOR_YELLOW, 0, 0, -20, 25, -1, 1);
	    if(PlayerInfo[playerid][pAdmin] == 4) aDutyText[playerid] = Create3DTextLabel(string, COLOR_ORANGE, 0, 0, -20, 25, -1, 1);
	    if(PlayerInfo[playerid][pAdmin] == 5) aDutyText[playerid] = Create3DTextLabel(string, COLOR_RED, 0, 0, -20, 25, -1, 1);
	    if(PlayerInfo[playerid][pAdmin] == 6) aDutyText[playerid] = Create3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, -1, 1);
		Attach3DTextLabelToPlayer(aDutyText[playerid], playerid, 0, 0, 0.25);*/
		if(IsValidDynamic3DTextLabel(aDutyText[playerid]))  DestroyDynamic3DTextLabel(aDutyText[playerid]);
		if(PlayerInfo[playerid][pAdmin] == 1) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_LIGHTGREEN, 0, 0, -20, 25, playerid);
	    if(PlayerInfo[playerid][pAdmin] == 2) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_LIME, 0, 0, -20, 25, playerid);
	    if(PlayerInfo[playerid][pAdmin] == 3) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, 0, 0, -20, 25, playerid);
	    if(PlayerInfo[playerid][pAdmin] == 4) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_ORANGE, 0, 0, -20, 25, playerid);
	    if(PlayerInfo[playerid][pAdmin] == 5) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_RED, 0, 0, -20, 25, playerid);
	    if(PlayerInfo[playerid][pAdmin] == 6) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_DARKRED, 0, 0, -20, 25, playerid);
        Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, aDutyText[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.25);
	}
	else
	{
	    if(Spec[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't go off admin duty while spectating someone.");
	    format(file, sizeof(file), "users/%s.ini",RPNU(playerid));
	    SaveChar(playerid);
	    ClearChar(playerid);
	    SetPlayerName(playerid, dini_Get(file, "OldName"));
		LoadChar(playerid);
		aDuty[playerid] = 0;
		SpawnChar(playerid);
	    format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
	    format(string, sizeof(string), "AdmCmd: %s has went off admin duty. (Admin name: %s)", RPN(playerid), dini_Get(file, "AdminName"));
	    SendAdminMessage(COLOR_DARKRED, 1, string);
		//Delete3DTextLabel(aDutyText[playerid]);
		DestroyDynamic3DTextLabel(aDutyText[playerid]);
	}
	return 1;
}
Help needed with it.
Reply
#2

What you server_log.txt say ?
Reply
#3

It dont show anything wrong.
Reply
#4

Try when you type command to make this error : "Choose an admin name using /aname first."
Quote:

if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Choose an admin name using /aname first.");

Just to see if this part work if is ok and you get error then put // before this lines
Quote:

Attach3DTextLabelToPlayer(aDutyText[playerid], playerid, 0, 0, 0.25);*/
if(IsValidDynamic3DTextLabel(aDutyText[playerid])) DestroyDynamic3DTextLabel(aDutyText[playerid]);
if(PlayerInfo[playerid][pAdmin] == 1) aDutyText[playerid] = CreateDynamic3DTextLabel(string, COLOR_LIGHTGREEN, 0, 0, -20, 25, playerid);

and this one
Quote:

Streamer_SetFloatData(STREAMER_TYPE_3D_TEXT_LABEL, aDutyText[playerid] , E_STREAMER_ATTACH_OFFSET_Z, 0.25);

And see if command still bug you ?
Reply
#5

Helped me thankyou
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)