Ajail script bug
#1

1.
Код:
public AjailCount(playerid)
{
if(pInfo[playerid][pJailTime] == 1)
{
new randSpawn = random(sizeof(randomSpawns_DayZSA_Part1));
SetPlayerPos_Allow(playerid,randomSpawns_DayZSA_Part1[randSpawn][0],randomSpawns_DayZSA_Part1[randSpawn][1],randomSpawns_DayZSA_Part1[randSpawn][2]);
pInfo[playerid][pJailTime] = 0;
}
else if(pInfo[playerid][pJailTime] >= 2)

{

SetTimerEx("AjailCount",60000,false,"u",playerid);
pInfo[playerid][pJailTime] -= 1;
}
return 1;
}


CMD:ajail(playerid, params[])
{
  new targetid, time, reason[64];
  if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not Admin");
  if(sscanf(params, "uis[64]", targetid, time, reason)) return SendClientMessage(playerid, -1, "USAGE: /ajail <playerid> <time> <reason>");
  if(time == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Minimum 1 minute !");
  SetPlayerPos(targetid, 346.870025, 309.259033, 999.155700);
  SetPlayerVirtualWorld(targetid, 2);
  SetPlayerInterior(targetid,6);
  pInfo[targetid][pJailTime] = time;
  new string[128], adminname[64], targetname[64];
  format(string, sizeof(string), "Administrator %s ajailed %s, reason: %s", GetPlayerName(playerid, adminname, sizeof(adminname)), GetPlayerName(playerid, targetname, sizeof(targetname)), reason);
  SendClientMessageToAll(COLOR_RED, string);
  AjailCount(targetid);
  return 1;
}

CMD:unjail(playerid, params[])
{
  new targetid;
  if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not admin !");
  if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /unajail <playerid>");
  if(pInfo[targetid][pJailTime] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not in the Ajail !");
  new randSpawn = random(sizeof(randomSpawns_DayZSA_Part1));
  SetPlayerPos_Allow(playerid,randomSpawns_DayZSA_Part1[randSpawn][0],randomSpawns_DayZSA_Part1[randSpawn][1],randomSpawns_DayZSA_Part1[randSpawn][2]);
  pInfo[playerid][pJailTime] = 0;
  return 1;

}



1. It won't save that a player is in admin jail. It only teleports him, but you can't /unjail him and neither the time if passes it won't respawn him. I don't have Jailtime counter..

2. When you use /unjail and respawns the player, it gives him blank screen. How Can I make him to respawn at some coordonates?



Help please, I worked at those cmds so long, asked so much help and saw so many tutorials and can't see what's the problem.
Reply
#2

For /aduty
Код:
format(string, sizeof(string), "{FF0000} %s is now Admin Duty. Use (/report) to ask help" ,string);
SendClientMessageToAll(-1, string);
you formatted string but didnt sent to players

and in "else"
Replace
Код:
SendClientMessage(playerid,COLOR_GREEN, "You are no longer on admin duty.");
to
Код:
new str[76], name[24];
GetPlayerName(playerid, name, 24);
format(str, sizeof(str), "{FF0000}%s is no longer admin on duty", name);
SendClientMessageToAll(COLOR_GREEN, str);
Reply
#3

For ajail:

Replace
Код:
format(string, sizeof(string), "Administrator %s ajailed %s, reason: %s", GetPlayerName(playerid, adminname, sizeof(adminname)), GetPlayerName(playerid, targetname, sizeof(targetname)), reason);
To
Код:
format(string, sizeof(string), "Administrator %s ajailed %s, reason: %s", GetPlayerName(playerid), GetPlayerName(targetid), reason);
Fixes the first bug
Reply
#4

Quote:
Originally Posted by Shinja
Посмотреть сообщение
For ajail:

Replace
Код:
format(string, sizeof(string), "Administrator %s ajailed %s, reason: %s", GetPlayerName(playerid, adminname, sizeof(adminname)), GetPlayerName(playerid, targetname, sizeof(targetname)), reason);
To
Код:
format(string, sizeof(string), "Administrator %s ajailed %s, reason: %s", GetPlayerName(playerid), GetPlayerName(targetid), reason);
Fixes the first bug
Код:
warning 202: number of arguments does not match definition 
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
warning 204: symbol is assigned a value that is never used: "targetname"
warning 204: symbol is assigned a value that is never used: "adminname"
Reply
#5

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
Код:
warning 202: number of arguments does not match definition 
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
warning 202: number of arguments does not match definition
warning 204: symbol is assigned a value that is never used: "targetname"
warning 204: symbol is assigned a value that is never used: "adminname"
I fixed.
Код:
GetPlayerName(playerid, adminname, sizeof(adminname));
GetPlayerName(playerid, targetname, sizeof(targetname));
format(string, sizeof(string), "Administrator %s ajailed %s, reason: %s", adminname, targetname, reason);
Reply
#6

You just have to remove targetname and adminname
or use what VVWVV said
both correct
Reply
#7

And aduty fixed?
Reply
#8

Thank you VVWVV and Shinja. It works.

But I still have bug at /ajail


1. It won't save that a player is in admin jail. It only teleports him, but you can't /unjail him and neither the time if passes it won't respawn him. I don't have Jailtime counter..

2. When you use /unjail and respawns the player, it gives him blank screen. How Can I make him to respawn at some coordonates?
Reply
#9

try this

PHP код:
new playertimer[MAX_PLAYERS];
public 
OnPlayerDisconnect(playeridreason)
{
    
KillTimer(playertimer[playerid]);
    return 
1;
}
forward AjailCount(playerid);
public 
AjailCount(playerid)
{
    if(
pInfo[playerid][pJailTime] != 0)
    {
            
pInfo[playerid][pJailTime]--;
        if(
pInfo[playerid][pJailTime] == 0)
        {
            new 
randSpawn random(sizeof(randomSpawns_DayZSA_Part1));
            
SetPlayerPos_Allow(playerid,randomSpawns_DayZSA_Part1[randSpawn][0],randomSpawns_DayZSA_Part1[randSpawn][1],randomSpawns_DayZSA_Part1[randSpawn][2]);
            
SetPlayerInterior(playerid0);//You can change interior
            
SetPlayerVirtualWorld(playerid0); //You can change virtual world
        
}
    }
    return 
1;
}
CMD:ajail(playeridparams[])
{
  new 
targetidtimereason[64];
  new 
string[128], adminname[64], targetname[64];
  if(
pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playeridCOLOR_RED"ERROR: You are not Admin");
  if(
sscanf(params"uis[64]"targetidtimereason)) return SendClientMessage(playerid, -1"USAGE: /ajail <playerid> <time> <reason>");
  if(
time == 0) return SendClientMessage(playeridCOLOR_RED"ERROR: Minimum 1 minute !");
  
GetPlayerName(targetidtargetnameMAX_PLAYER_NAME);
  
GetPlayerName(playeridadminnameMAX_PLAYER_NAME);
  
SetPlayerPos(targetid346.870025309.259033999.155700);
  
SetPlayerVirtualWorld(targetid2);
  
SetPlayerInterior(targetid,6);
  
pInfo[targetid][pJailTime] = time;
  
format(stringsizeof(string), "Administrator %s ajailed %s, reason: %s"adminnametargetnamereason);
  
SendClientMessageToAll(COLOR_REDstring);
  
playertimer[targetid] = SetTimerEx("AjailCount"10001"i"playerid);
  return 
1;

Reply
#10

invalid expression, assumed zero, undefined symbol "reason" at public OnPlayerDisconnect(playerid, reason)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)