Unprison and Unjail Problem
#1

pawn Код:
}
    if(strcmp(cmd, "/unprison",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 2)
            {
                SendClientMessage(playerid, COLOR_GREY, "   you are not authorized to use this command!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /unprison [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));

                    format(string, sizeof(string), "You unprisoned %s (%d).", giveplayer, giveplayerid);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    format(string, sizeof(string), "* You have been unprisoned by %s.", sendername);
                    SendClientMessage(giveplayerid, COLOR_ORANGE, string);
                    PlayerInfo[giveplayerid][pJailTime] = 0;
                    PlayerInfo[giveplayerid][pJailed] = 0;
                    TextDrawHideForPlayer(giveplayerid, Textdraw1[giveplayerid]);
                    SetPlayerWorldBounds(giveplayerid, 20000.0000,-20000.0000,20000.0000,-20000.0000);
                    SafeSetPlayerPos(giveplayerid, 93.4852,1920.6235,18.0450);
                    format(string, sizeof(string), "%s (%d), has been unprisoned by %s.", giveplayer, giveplayerid, sendername);
                    SendClientMessageToAll(COLOR_NICERED,string);
                    format(string, 256, "[ADMIN]: %s (%d), has been un-prisoned by %s.", giveplayer, giveplayerid, sendername);
                    ABroadCast(COLOR_LIGHTRED,string, 5);
                    new y, m, d;
                    new h,mi,s;
                    getdate(y,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Removed %s From Prison.",d,m,y,h,mi,s,sendername,giveplayer);
                    JailLog(string);
                }
            }
        }
        return 1;
        }
        if(strcmp(cmd, "/unjail", true) == 0)
        {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /unjail [playerid/PartOfName] <reason>");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(PlayerInfo[giveplayerid][pJailed] >= 1)
                        {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            new length = strlen(cmdtext);
                            while ((idx < length) && (cmdtext[idx] <= ' '))
                            {
                                idx++;
                            }
                            new offset = idx;
                            new result[128];
                            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                            {
                                result[idx - offset] = cmdtext[idx];
                                idx++;
                            }
                            result[idx - offset] = EOS;
                            if(!strlen(result))
                            {
                                new y, m, d;
                                new h,mi,s;
                                getdate(y,m,d);
                                gettime(h,mi,s);
                                format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Unjailed %s, No Reason Given",d,m,y,h,mi,s,sendername,giveplayer);
                                JailLog(string);
                                PlayerInfo[giveplayerid][pJailTime] = 0;
                                format(string, sizeof(string), "%s (%d), Has been unjailed by Administrator %s", giveplayer, giveplayerid, sendername);
                                SendClientMessageToAll(COLOR_NICERED, string);
                                format(string, sizeof(string), "[ADMIN]: %s has unjailed %s (%d), No Reason Given",sendername,giveplayer,giveplayerid);
                                SendAdminMessage(COLOR_LIGHTRED, string);
                                GameTextForPlayer(giveplayerid, "~g~~h~Unjailed: ~n~~g~No Reason Given", 6000, 3);
                                return 1;
                            }
                            new y, m, d;
                            new h,mi,s;
                            getdate(y,m,d);
                            gettime(h,mi,s);
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Unjailed %s for: %s",d,m,y,h,mi,s,sendername,giveplayer, (result));
                            JailLog(string);
                            PlayerInfo[giveplayerid][pJailTime] = 0;
                            format(string, sizeof(string), "%s (%d), Has been unjailed by Administrator %s", giveplayer, giveplayerid, sendername, (result));
                            SendClientMessageToAll(COLOR_NICERED, string);
                            format(string, sizeof(string), "[ADMIN]: %s has unjailed %s (%d) for %s",sendername,giveplayer,giveplayerid,(result));
                            SendAdminMessage(COLOR_LIGHTRED, string);
                            format(string, sizeof(string), "~g~~h~Unjailed: ~n~~g~%s",(result));
                            GameTextForPlayer(giveplayerid, string, 6000, 3);
                            return 1;
                        }
                    }
                }
            }
            else
            {
                format(string, sizeof(string), "** %d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
Errors:
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1215) : error 017: undefined symbol "Textdraw1"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1215) : warning 215: expression has no effect
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1215) : error 001: expected token: ";", but found "]"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1215) : error 029: invalid expression, assumed zero
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1215) : fatal error 107: too many error messages on one line

pawn Код:
Line 21215

TextDrawHideForPlayer(giveplayerid, Textdraw1[giveplayerid]);
Reply
#2

At the top of your code somewhere;
pawn Код:
new Text:Textdraw1[MAX_PLAYERS];
Reply
#3

Errors:

D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1218 ) : error 017: undefined symbol "SafeSetPlayerPos"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1220 ) : error 017: undefined symbol "COLOR_NICERED"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1228 ) : error 017: undefined symbol "JailLog"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1303 ) : warning 217: loose indentation
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1343 ) : error 017: undefined symbol "JailLog"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1346 ) : error 017: undefined symbol "COLOR_NICERED"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1357 ) : error 017: undefined symbol "JailLog"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1360 ) : error 017: undefined symbol "COLOR_NICERED"
D:\Lataukset\Server\Server\MRP\gamemodes\mrp.pwn(2 1378 ) : warning 217: loose indentation

pawn Код:
Line 21218 SafeSetPlayerPos(giveplayerid, 93.4852,1920.6235,18.0450);
Line 21220 SendClientMessageToAll(COLOR_NICERED,string);
Line 21228 JailLog(string);
Line 21303 if(strcmp(cmd, "/unjail", true) == 0)
Line 21343  JailLog(string);
Line 21346 SendClientMessageToAll(COLOR_NICERED, string);
Line 21357 JailLog(string);
Line 21360 SendClientMessageToAll(COLOR_NICERED, string);
Line 21378  if(strcmp(cmd, "/tod", true) == 0)
Reply
#4

Here's an idea, make your own command.

Of course, you do not know what you're doing only that when you see "/..." it's a command. This type of command is not that hard, to be honest. I'll direct you here, it could prove useful for you in the future.
Reply
#5

The two Loose Indentation warnings simply mean that your code isn't indented properly.

Examples:
pawn Код:
//Bad Indentation
        if(strcmp(cmd, "/unjail", true) == 0)
{
      //code here
           return 1;
}
pawn Код:
//Good indentation (Depending on how you code I guess)
if(strcmp(cmd, "/unjail", true) == 0)
{
    //code here
    return 1;
}
The other errors simply mean they're not defined. So for your color problem;

pawn Код:
#define COLOR_NICERED 0xFF0000AA
That's just a random red color.

Your error for JailLog and SafeSetPlayerPos also simply mean they're not defined. Although, why not simply take the "Safe" part of the SetPlayerPos out, and see, since SetPlayerPos is already a defined native in SA-MP.

EDIT:
For your jaillog

pawn Код:
stock JailLog(message[])
{
    new File:jaillog;
    if (fexist("jaillog.txt")) jaillog = fopen("jaillog.log.txt", io_append);
    else jaillog = fopen("jaillog.txt", io_write);
    fwrite(jaillog, message); fputchar(jaillog, 13); fputchar(jaillog, 10); fclose(jaillog);
}
All you need to do is create jaillog.txt in your scriptfiles folder.
Reply
#6

Ok thanks Its now work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)