03.01.2013, 12:45
Seguinte, tava tentando fazer uma agendar cadeia, mas ta osso aki,
eu dou agendar cadeia em mim, mas quando eu relogo nгo vou pra cadeia.
Alguem pode me ajudar?
Comando Agendar Cadeia
Public SetPlayerSpawn
public OnPlayerLogin
public OnPlayerUpdate
Public OnPlayerSave
eu dou agendar cadeia em mim, mas quando eu relogo nгo vou pra cadeia.
Alguem pode me ajudar?
Comando Agendar Cadeia
PHP код:
if(strcmp(cmd, "/agendarcadeia",true) == 0 || strcmp(cmd, "/agendarnome",true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmpo[20];
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo esta autorizado para usar este comando!");
return true;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /agendarcadeia [NOME_CORRETO] [Tempo] [Motivo]");
return true;
}
tmpo = strtok(cmdtext, idx);
if(!strlen(tmpo))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /agendarcadeia [NOME_CORRETO] [Tempo] [Motivo]");
return true;
}
new tempo2 = strval(tmpo);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /agendarcadeia [NOME_CORRETO] [Tempo] [Motivo]");
return true;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new arquivo[128];
format(arquivo, sizeof(arquivo), "Contas/%s.ini",tmp);
if(!dini_Exists(arquivo))
{
SendClientMessage(playerid, COLOR_WHITE, "[ERRO] Este nick nгo estб registrado!");
return true;
}
format(string, sizeof(string), "O Admin %s agendou o nick %s para %d minutos de cadeia, Motivo: %s",PlayerName(playerid), tmp, tempo2, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
AgendarLog(string);
dini_IntSet(arquivo,"Jailed",11);
dini_IntSet(arquivo,"JailTime",tempo2 * 60);
strmid(AgendouInfo[playerid][cAdminAgendou], sendername, 0, strlen(sendername), MAX_PLAYER_NAME);
dini_Set(arquivo,"AdminAgendou",sendername);
strmid(AgendouInfo[playerid][cMotivoAgendou], result, 0, strlen(result), MAX_PLAYER_NAME);
dini_Set(arquivo,"MotivoAgendou",result);
dini_IntSet(arquivo,"Agendado",1);
dini_IntSet(arquivo,"TempoAgendado",tempo2);
}
return true;
}
PHP код:
enum pInfo
{
pAgendado,pTempoAgendado,pAdminAgendou[64],pMotivoAgendou[128]
};
PHP код:
if(PlayerInfo[playerid][pJailed] == 11)
{
if(PlayerInfo[playerid][pAgendado] == 1)
{
new motivoagendou[128];
strmid(motivoagendou, PlayerInfo[playerid][pMotivoAgendou], 0, strlen(PlayerInfo[playerid][pMotivoAgendou]), 255);
new adminagendou[64];
strmid(adminagendou, PlayerInfo[playerid][pAdminAgendou], 0, strlen(PlayerInfo[playerid][pAdminAgendou]), 255);
format(stringagendou, sizeof(stringagendou), "O Admin %s agendou vocк para %d minutos de cadeia, Motivo: %s", adminagendou, PlayerInfo[playerid][pTempoAgendado], motivoagendou);
SendClientMessage(playerid, COLOR_LIGHTRED, stringagendou);
PlayerInfo[playerid][pAgendado] = 0;
}
XXAirBreak[playerid] += 3;
SetPlayerInterior(playerid, 18);
XXAirBreak[playerid] += 3;
SetPlayerPos(playerid, 1302.519897,-1.787510,1001.028259);//XXAirBreak[playerid] += 3;SetPlayerPos(playerid,1175.6014,-1179.9524,87.0427);
//SetPlayerWorldBounds(playerid, 337.5694,101.5826,1940.9759,1798.7453); //285.3481,96.9720,1940.9755,1799.0811
SendClientMessage(playerid, COLOR_LIGHTRED, "Sentenзa incompleta,Vocк voltou para Cadeia!");
return true;
}
PHP код:
if( strcmp( key , "AdminAgendou" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdminAgendou] = strval( val ); }
if( strcmp( key , "MotivoAgendou" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMotivoAgendou] = strval( val ); }
if( strcmp( key , "Agendado" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAgendado] = strval( val ); }
if( strcmp( key , "TempoAgendado" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTempoAgendado] = strval( val ); }
PHP код:
format(var, 32, "AdminAgendou=%d\n",PlayerInfo[playerid][pAdminAgendou]);fwrite(hFile, var);
format(var, 32, "MotivoAgendou=%d\n",PlayerInfo[playerid][pMotivoAgendou]);fwrite(hFile, var);
format(var, 32, "Agendado=%d\n",PlayerInfo[playerid][pAgendado]);fwrite(hFile, var);
format(var, 32, "TempoAgendado=%d\n",PlayerInfo[playerid][pTempoAgendado]);fwrite(hFile, var);
PHP код:
format(var, 32, "AdminAgendou=%d\n",PlayerInfo[playerid][pAdminAgendou]);fwrite(hFile, var);
format(var, 32, "MotivoAgendou=%d\n",PlayerInfo[playerid][pMotivoAgendou]);fwrite(hFile, var);
format(var, 32, "Agendado=%d\n",PlayerInfo[playerid][pAgendado]);fwrite(hFile, var);
format(var, 32, "TempoAgendado=%d\n",PlayerInfo[playerid][pTempoAgendado]);fwrite(hFile, var);