Freeze set to 0?
#1

hey guys. i have problem with my admin system. the /freeze and /unfreeze command is working.
the problem is:

pawn Code:
public OnPlayerSpawn(playerid)
{
    if(dini_Int(file, "Freeze") == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "Your punishment (freeze) is not done yet, Your still freezed!");
        TogglePlayerControllable(playerid, false);
        return 1;
    }
return 1;
}
i have that system. when i left the server (Freeze=1 turn on) it sets Freeze=1 to 0

here is the code

pawn Code:
CMD:freeze(playerid, params[])
{
    new string[128],
        id,
        pname[MAX_PLAYER_NAME],
        victimname[MAX_PLAYER_NAME],
        reason[30];
    if(PlayerInfo[playerid][Admin] > 3)
    {
        if(sscanf(params, "us[30]", id, reason)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /freeze <playername/id> <reason>");
        if(IsPlayerNPC(id)) return SendClientMessage(playerid, COLOR_RED, "You cannot freeze NPC Bots!");
        if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot freeze yourself!");
        GetPlayerName(playerid, pname, sizeof(pname));
        GetPlayerName(id, victimname, sizeof(victimname));
        if(PlayerInfo[id][Freeze] == 0)
        {
           format(string, sizeof(string), "ADMIN-SPEC: %s has used /freeze", pname);
           SentMessageToAdmins(COLOR_GREY, string);
           PlayerInfo[id][Freeze] = 1;
           TogglePlayerControllable(id, false);
           format(string, sizeof(string), "%s(ID:%d) has been freezed Administrator %s(ID:%d) | Reason: %s", victimname, id, pname, playerid, reason);
           SendClientMessageToAll(COLOR_RED, string);
           format(string, sizeof(string), "| - You freeze %s(ID:%d) | Reason %s - |", victimname, id, reason);
           SendClientMessage(playerid, COLOR_RED, string);
           format(string, sizeof(string), "| - You have been freeze by Administrator %s(ID:%d) | Reason %s - |", pname, playerid, reason);
           SendClientMessage(playerid, COLOR_RED, string);
        }
        else return SendClientMessage(playerid, COLOR_RED, "That player is already frozen!");
    }
    else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 3 or higher to use this command!");
    return 1;
}

CMD:unfreeze(playerid, params[])
{
    new string[128],
        id,
        pname[MAX_PLAYER_NAME],
        victimname[MAX_PLAYER_NAME];
    if(PlayerInfo[playerid][Admin] > 3)
    {
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /unfreeze <playername/id>");
        if(IsPlayerNPC(id)) return SendClientMessage(playerid, COLOR_RED, "You cannot unfreeze NPC Bots!");
        GetPlayerName(playerid, pname, sizeof(pname));
        GetPlayerName(id, victimname, sizeof(victimname));
        if(PlayerInfo[id][Freeze] == 1)
        {
           format(string, sizeof(string), "ADMIN-SPEC: %s has used /unfreeze", pname);
           SentMessageToAdmins(COLOR_GREY, string);
           PlayerInfo[id][Freeze] = 0;
           TogglePlayerControllable(id, true);
           format(string, sizeof(string), "%s(ID:%d) has been unfreezed Administrator %s(ID:%d)", victimname, id, pname, playerid);
           SendClientMessageToAll(COLOR_YELLOW, string);
           format(string, sizeof(string), "| - You unfreeze %s(ID:%d) - |", victimname, id);
           SendClientMessage(playerid, COLOR_GREEN, string);
           format(string, sizeof(string), "| - You have been unfreeze by Administrator %s(ID:%d) - |", pname, playerid);
           SendClientMessage(playerid, COLOR_RED, string);
        }
        else return SendClientMessage(playerid, COLOR_RED, "That player is already unfreeze!");
    }
    else return SendClientMessage(playerid, COLOR_RED, "You must be Administrator Level 3 or higher to use this command!");
    return 1;
}
and one more question how to check the banned-ip from samp-ban file?
Reply
#2

pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Score", PlayerInfo[playerid][Score]);
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "Deaths", PlayerInfo[playerid][Deaths]);
        dini_IntSet(file, "Kills", PlayerInfo[playerid][Kills]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][Admin]);
        dini_IntSet(file, "Freeze", PlayerInfo[playerid][Freeze]);
    }
    gPlayerLogged[playerid] = 0;
    GodMode[playerid] = 0; IsAdminInDuty[playerid] = 0;
    return 1;
}
Someone? the code OnPlayerDisconnect is given.
Reply
#3

Well first off, there is no reason to save the freeze... It will just mess with player on spawn, and it might freeze it in air or something. So, maybe not saving it, or just setting it to 0 on player disconnect should solve.
Reply
#4

so i will remove the player-saving Freeze?, i want to resume there punishment when they go in-game again.

This forum requires that you wait 120 seconds between posts. Please try again in 5 seconds. ah this sucks!
Reply
#5

Quote:
Originally Posted by RobotBox
View Post
so i will remove the player-saving Freeze?, i want to resume there punishment when they go in-game again.

This forum requires that you wait 120 seconds between posts. Please try again in 5 seconds. ah this sucks!
Well.. Freeze isn't really a good punishment, /ajail is better and simply if player spawn on air for some reason and it freezes, player will be frozen on the air, and this might also be taken as hacks for some admin.

Player can just spawn and fall due to PC loading lags...


But post the login/spawn code please. The code part where it set player variables(PlayerInfo).
Reply
#6

Quote:
Originally Posted by ricardo178
View Post
Well.. Freeze isn't really a good punishment, /ajail is better and simply if player spawn on air for some reason and it freezes, player will be frozen on the air, and this might also be taken as hacks for some admin.

Player can just spawn and fall due to PC loading lags...
Actually the spawnpoint is not taken from Air. he will spawn directly from the ground. However you say

"and this might also be taken as hacks for some admin"

so i'm not sure if i will continue to add Freeze Punishment.
Reply
#7

Quote:
Originally Posted by RobotBox
View Post
Actually the spawnpoint is not taken from Air. he will spawn directly from the ground. However you say

"and this might also be taken as hacks for some admin"

so i'm not sure if i will continue to add Freeze Punishment.
By the way, post the code that set PlayerInfo variables on login. Should be OnDialogResponse if you using dialogs registering system, and show also OnPlayerSpawn.
Reply
#8

Quote:
Originally Posted by ricardo178
View Post
By the way, post the code that set PlayerInfo variables on login. Should be OnDialogResponse if you using dialogs registering system, and show also OnPlayerSpawn.
Well i already post the code of OnPlayerSpawn at the top
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)