/oprison help
#1

Well, this my code, for a offline prison, but its not working, the player is not going injail if you did this
pawn Код:
CMD:oprison(playerid, params[])
{
    new playerb[32], string[128], file[32], time;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
    if(sscanf(params, "s[32]is[128]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
    if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead.");
    format(file, sizeof(file), "users/%s.ini", playerb);
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
    if(PlayerInfo[playerid][pAdmin] < dini_Int(file, "Admin")) return SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
    format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), params);
    SendClientMessageToAll(COLOR_LIGHTRED, string);
    format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid) , params);
    // Prisoning
    dini_IntSet(file, "pPrison", 1);
    // Prisonreason
    dini_Set(file, "pPrisonReason", params);
    dini_Set(file, "pPrisonBy", RPNU(playerid));
    dini_IntSet(file, "pPrisonTime", time);
    return 1;
}
Reply
#2

pawn Код:
CMD:oprison(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");

    new playerb[MAX_PLAYER_NAME + 1], time, reason[120];
    if(sscanf(params, "s[" #MAX_PLAYER_NAME "]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
    else if(RPIDFN(playerb) != INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead.");
    else{
        new file[35];
        format(file, sizeof(file), "users/%s.ini", playerb);
        if(!dini_Exists(file)) SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
        else if(PlayerInfo[playerid][pAdmin] < dini_Int(file, "Admin")) SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
        else{
            new string[128];
            format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), reason);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            // Prisoning
            dini_IntSet(file, "pPrison", 1);
            // Prisonreason
            dini_Set(file, "pPrisonReason", reason);
            dini_Set(file, "pPrisonBy", RPNU(playerid));
            dini_IntSet(file, "pPrisonTime", time);
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
CMD:oprison(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");

    new playerb[MAX_PLAYER_NAME + 1], time, reason[120];
    if(sscanf(params, "s[" #MAX_PLAYER_NAME "]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
    else if(RPIDFN(playerb) != INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead.");
    else{
        new file[35];
        format(file, sizeof(file), "users/%s.ini", playerb);
        if(!dini_Exists(file)) SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
        else if(PlayerInfo[playerid][pAdmin] < dini_Int(file, "Admin")) SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
        else{
            new string[128];
            format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), reason);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            // Prisoning
            dini_IntSet(file, "pPrison", 1);
            // Prisonreason
            dini_Set(file, "pPrisonReason", reason);
            dini_Set(file, "pPrisonBy", RPNU(playerid));
            dini_IntSet(file, "pPrisonTime", time);
        }
    }
    return 1;
}
pawn Код:
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : error 001: expected token: ")", but found "-string-"
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : warning 215: expression has no effect
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : warning 215: expression has no effect
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : warning 215: expression has no effect
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : warning 215: expression has no effect
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : error 001: expected token: ";", but found ")"
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : error 029: invalid expression, assumed zero
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : fatal error 107: too many error messages on one line
pawn Код:
if(sscanf(params, "s[" #MAX_PLAYER_NAME "]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
Reply
#4

pawn Код:
CMD:oprison(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");

    new playerb[MAX_PLAYER_NAME + 1], time, reason[120];
    if(sscanf(params, "s[" #MAX_PLAYER_NAME "]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
    else if(RPIDFN(playerb) != INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead.");
    else{
        new file[35];
        format(file, sizeof(file), "users/%s.ini", playerb);
        if(!dini_Exists(file)) SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
        else if(dUserINT(playerb).("Admin") > PlayerInfo[playerid][pAdmin]) SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
        else{
            new string[128];
            format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), reason);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            // Prisoning
            new File:Jail;
            Jail = fopen(file,io_append);
            dUserSetINT(playerb).("pPrison",1);
            // Prisonreason
            dUserSetINT(playerb).("pPrisonReason", reason);
            dUserSetINT(playerb).("pPrisonBy", RPNU(playerid));
            dUserSetINT(playerb).("pPrisonTime", time);
            fclose(Jail);
        }
    }
    return 1;
}
Try this cmd.
Reply
#5

Quote:
Originally Posted by Hanuman
Посмотреть сообщение
pawn Код:
CMD:oprison(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");

    new playerb[MAX_PLAYER_NAME + 1], time, reason[120];
    if(sscanf(params, "s[" #MAX_PLAYER_NAME "]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
    else if(RPIDFN(playerb) != INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead.");
    else{
        new file[35];
        format(file, sizeof(file), "users/%s.ini", playerb);
        if(!dini_Exists(file)) SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
        else if(dUserINT(playerb).("Admin") > PlayerInfo[playerid][pAdmin]) SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
        else{
            new string[128];
            format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), reason);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            // Prisoning
            new File:Jail;
            Jail = fopen(file,io_append);
            dUserSetINT(playerb).("pPrison",1);
            // Prisonreason
            dUserSetINT(playerb).("pPrisonReason", reason);
            dUserSetINT(playerb).("pPrisonBy", RPNU(playerid));
            dUserSetINT(playerb).("pPrisonTime", time);
            fclose(Jail);
        }
    }
    return 1;
}
Try this cmd.
Same Errors

pawn Код:
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : error 001: expected token: ")", but found "-string-"
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : warning 215: expression has no effect
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : warning 215: expression has no effect
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : warning 215: expression has no effect
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : warning 215: expression has no effect
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : error 001: expected token: ";", but found ")"
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : error 029: invalid expression, assumed zero
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22721) : fatal error 107: too many error messages on one line
pawn Код:
if(sscanf(params, "s[" #MAX_PLAYER_NAME "]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
Reply
#6

Give the line 22721
Reply
#7

pawn Код:
if(sscanf(params, "s[" #MAX_PLAYER_NAME "]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
Reply
#8

pawn Код:
CMD:oprison(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");

    new playerb[128], time, reason[120];
    if(sscanf(params, "s[128]is[120]", playerb, time, reason)) SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /oprison [playername] [time] [reason]");
    else if(RPIDFN(playerb) != INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead.");
    else{
        new file[35];
        format(file, sizeof(file), "users/%s.ini", playerb);
        if(!dini_Exists(file)) SendClientMessage(playerid, COLOR_GREY, "Player name not found.");
        else if(dUserINT(playerb).("Admin") > PlayerInfo[playerid][pAdmin]) SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you.");
        else{
            new string[128];
            format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), reason);
            SendClientMessageToAll(COLOR_LIGHTRED, string);
            // Prisoning
            new File:Jail;
            Jail = fopen(file,io_append);
            dUserSetINT(playerb).("pPrison",1);
            // Prisonreason
            dUserSetINT(playerb).("pPrisonReason", reason);
            dUserSetINT(playerb).("pPrisonBy", RPNU(playerid));
            dUserSetINT(playerb).("pPrisonTime", time);
            fclose(Jail);
        }
    }
    return 1;
}
What about this?
Reply
#9

pawn Код:
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22738) : error 035: argument type mismatch (argument 3)
C:\Users\Davey\Desktop\LSC-RP\gamemodes\LSC-RP.pwn(22739) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
pawn Код:
dUserSetINT(playerb).("pPrisonReason", reason);
dUserSetINT(playerb).("pPrisonBy", RPNU(playerid));
Reply
#10

Hmm.. Then replace the line with ur codes that are
pawn Код:
dini_Set(file, "pPrisonReason", reason);
dini_Set(file, "pPrisonBy", RPNU(playerid));
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)