[Pedido] Vip automatico -
brunim - 25.07.2011
Ola, estou a busca de um comando para dar vip e o vip sair automaticamente em 30 dias...
Atualmente estou usando esse:
pawn Код:
if(strcmp(cmd, "/darvip", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [playerid/PartOfName]");
return 1;
}
new para1;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new nome[24];
GetPlayerName(playerid, nome, sizeof nome);
if(PlayerInfo[playerid][pAdmin] >= 5000)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pDonateRank] = 1;
format(string, sizeof(string), "Vocк deu VIP para %s. ",giveplayer);
SendClientMessage(playerid, COLOR_OOC, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo estб autorizado a usar este comando!");
}
}
return 1;
}
Sera que alguem poderia modificar ele para ficar automatico? ou me mandar algum tutorial ensinando :/ ficaria grato, obrigado.
Re: [Pedido] Vip automatico -
FoxXx - 25.07.2011
isso ta no registro filhote
deve ter algo como
PlayerInfo[para1][pDonateRank] = 0;
Re: [Pedido] Vip automatico -
brunim - 25.07.2011
como assim ?
Re: [Pedido] Vip automatico -
FoxXx - 25.07.2011
PQP olha no registro do gm la deve ter algo do genero pra definir q ele comeзa com cip setado a 0
Re: [Pedido] Vip automatico -
Shadoww5 - 25.07.2011
Testei o cуdigo e esta funcionando corretamente.
As informaзхes sгo salvar no arquivo
Vips.txt, que й criado automaticamente quando o GM й iniciado, e, toda vez que o jogador й spawnado, o privilйgio de VIP e checado, caso jб tenha expirado, ele perde o beneficio.
PHP код:
#include <Dini>
public OnGameModeInit()
{
if(!fexist("Vips.txt")) { dini_Create("Vips.txt"); }
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][pDonateRank] == 1)
{
new n[24];
GetPlayerName(playerid, n, 24);
if(dini_Isset("Vips.txt", n))
{
if(getdate() >= dini_Int("Vips.txt", n))
{
SendClientMessage(playerid, 0xFFFF00FF, "Seu tempo de VIP expirou !");
PlayerInfo[playerid][pDonateRank] = 0;
dini_Unset("Vips.txt", n);
}
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx, tmp[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/darvip", true) == 0)
{
new id, dias, n[24], n2[24], str[128];
if(PlayerInfo[playerid][pAdmin] < 5000) return SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo estб autorizado a usar este comando!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [playerid/PartOfName] [dias]");
id = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [playerid/PartOfName] [dias]");
dias = strval(tmp);
if(dias < 1) return SendClientMessage(playerid, COLOR_GRAD2, "A quantidade de dias deve ser superior а 1.");
if((getdate() + dias) >= 365) return SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo pode escolher esta quantidade de dias.");
GetPlayerName(playerid, n, 24);
GetPlayerName(id, n2, 24);
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "ID Invбlido.");
PlayerInfo[id][pDonateRank] = 1;
format(str, sizeof str, "Vocк deu VIP para %s por %d dias.", n2, dias);
SendClientMessage(playerid, COLOR_OOC, str);
format(str, sizeof str, "%s te deu VIP por %d dias.", n, dias);
SendClientMessage(id, COLOR_OOC, str);
dini_IntSet("Vips.txt", n2, getdate()+dias);
return 1;
}
return 0;
}
Re: [Pedido] Vip automatico -
brunim - 26.07.2011
vo testar Shadoww5, vlws rep+
Re: [Pedido] Vip automatico -
brunim - 26.07.2011
agora ele da esses erros ao compilar:
pawn Код:
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(1170) : error 021: symbol already defined: "Time"
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(4902) : error 076: syntax error in the expression, or invalid function call
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(4903) : error 076: syntax error in the expression, or invalid function call
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(4904) : error 076: syntax error in the expression, or invalid function call
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(4905) : error 076: syntax error in the expression, or invalid function call
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(13792) : error 076: syntax error in the expression, or invalid function call
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(15231) : error 076: syntax error in the expression, or invalid function call
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(19599) : error 076: syntax error in the expression, or invalid function call
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(19599) : error 076: syntax error in the expression, or invalid function call
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(22350) : error 021: symbol already defined: "strtok"
D:\PCS-SAMP\Compiler\gamemodes\projetosa.pwn(22365) : error 047: array sizes do not match, or destination array is too small
Re: [Pedido] Vip automatico -
Ricop522 - 26.07.2011
Nгo vai funcionar devido ter que possui os parвmetros do gettime(ano,mes,dia);
Toma aqui,.
pawn Код:
stock vipDias(playerid, dias)
{
if(!IsPlayerConnected(playerid)) return 1;
new j_ano, j_dia, j_mes, j_String[128], j_Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, j_Nome, sizeof(j_Nome));
getdate(j_ano, j_mes, j_dia);
j_dia += dias;
while(j_dia > 31) {
j_dia -= 31;
j_mes++;
}
while(j_mes > 12) {
j_mes -= 12;
j_ano++;
}
format(j_String, sizeof(j_String), "Vip%s.ini", j_Nome);
if(!dini_Exists(j_String)) {
dini_Create(j_String);
dini_IntSet(j_String, "Dia", j_dia);
dini_IntSet(j_String, "Mes", j_mes);
dini_IntSet(j_String, "Ano", j_ano);
}
else {
dini_IntSet(j_String, "Dia", j_dia);
dini_IntSet(j_String, "Mes", j_mes);
dini_IntSet(j_String, "Ano", j_ano);
}
PlayerInfo[playerid][pVip] = 1;
return 0x01;
}
Eu quem fiz, testa.
reputation? :/
Re: [Pedido] Vip automatico -
RockFire - 26.07.2011
Claro que funciona sem os parвmetros dia mes ano ele da o Unix Time Stamp que й uma contagem de segundos desde 01/01/1970
http://www.unixtimestamp.com/
Re: [Pedido] Vip automatico -
Ricop522 - 26.07.2011
Perdгo, quis dizer Getdate().