26.01.2012, 16:22
Procure por new PlayerInfo no seu GM e duas linhas antes do };, coloque isto:
Lembre-se, tambйm, de fazer o saving e loading da variavel.
Код:
pDays,
PHP код:
public OnPlayerUpdate(playerid)
{
if(PlayerInfo[playerid][pVIP] != 0 && gettime() >= PlayerInfo[playerid][pDays])
{
SendClientMessage(playerid, -1, "Seu perнodo de VIP acabou.");
PlayerInfo[giveid][pVIP] = 0;
PlayerInfo[playerid][pDays] = 0;
new sStr[24];
GetPlayerName(playerid, sStr, 24);
for(new i = 0; i < sizeof(VipInfo); i++)
{
if(strcmp(sStr,VipInfo[i][vNick],true)==0)
{
VipInfo[i][vTipo] = 0;
strmid(VipInfo[i][vNick], "Ninguem", 0, 16, 255);
return SaveVip();
}
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/darvip", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 1337)
return SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo tem autorizaзгo para usar esse comando.");
VipVaga();
if(!VagaSobrando)
return SendClientMessage(playerid, COLOR_GRAD1, "Nгo hб mais vagas na lista use /limparvip primeiro.");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [id] [nivel] [dias]");
new giveid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [id] [nivel] [dias]");
new level = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [id] [nivel] [dias]");
new dias = strval(tmp);
GetPlayerName(giveid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(!IsPlayerConnected(giveid) || giveid != INVALID_PLAYER_ID)
return 1;
format(string, sizeof string, "Vocк deu VIP Nнvel %d para %s por %d dias", level, giveplayer, dias);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof string, "Vocк ganhou VIP Nнvel %d por %d dias do admin %s", level, dias, sendername);
SendClientMessage(giveid, COLOR_LIGHTBLUE, string);
getdate(year, month, day);
gettime(hour,minute,second);
format(string, sizeof(string), "%s deu vip ao %s nнvel %d por %d dias (%d/%d/%d - %d:%d)",sendername,giveplayer,level, dias, day, month, year,hour, minute);
VipsLog(string);
PlayerInfo[giveid][pVIP] = level;
PlayerInfo[giveid][pDays] = gettime()+dias*86400;
for(new i = 0; i < sizeof(VipInfo); i++)
{
if(strcmp(giveplayer,VipInfo[i][vNick],true)==0)
{
VipInfo[i][vTipo] = level;
return SaveVip();
}
if(strcmp("Ninguem",VipInfo[i][vNick],true)==0)
{
VipInfo[i][vTipo] = level;
return SaveVip();
}
}
return 1;
}
return 0;
}