23.07.2013, 14:03
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:
Here's the setadminname command:
I have no idea why it does it, I'm still kinda new to the whole coding thing.
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;
}
Код:
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;
}

