if(strcmp(cmd, "/darvip", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1337)
{
SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo tem autorizaзгo para usar esse comando.");
return 1;
}
VipVaga();
if(VagaSobrando == 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "Nгo hб mais vagas na lista use /limparvip primeiro.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [id] [Nivel]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvip [id] [Nivel]");
return 1;
}
level = strval(tmp);
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
format(string, sizeof string, "Vocк deu VIP Nнvel %d para %s", level, giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof string, "Vocк ganhou VIP Nнvel %d do admin %s", level, sendername);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
getdate(year, month, day);
gettime(hour,minute,second);
format(string, sizeof(string), "%s deu vip ao %s nнvel %d (%d/%d/%d - %d:%d)",sendername,giveplayer,level,day, month, year,hour, minute);
VipsLog(string);
PlayerInfo[para1][pVIP] = level;
new var03 = 0;
for(new i = 0; i < sizeof(VipInfo); i++)
{
if(strcmp(giveplayer,VipInfo[i][vNick],true)==0)
{
VipInfo[i][vTipo] = level;
SaveVip();
var03 = 1;
break;
}
}
if(var03 == 0)
{
for(new i = 0; i < sizeof(VipInfo); i++)
{
if(strcmp("Ninguem",VipInfo[i][vNick],true)==0)
{
strmid(VipInfo[i][vNick], giveplayer, 0, strlen(giveplayer), 255);
VipInfo[i][vTipo] = level;
SaveVip();
break;
}
}
}
}
}
}
return 1;
}
public VipVaga()
{
for(new idx=0; idx<sizeof(VipInfo); idx++)
{
if(strcmp(VipInfo[idx][vNick],"Ninguem", true ) == 0 )
{
VagaSobrando = 1;
return 1;
}
}
VagaSobrando = 0;
return 0;
}
////////////////////////////// OU й ESSE o VIPVAGA:
enum vinfo
{
vNick[MAX_PLAYER_NAME],
vTipo
};
new VipInfo[51][vinfo];
forward VipCheck(playerid);
forward VipVaga();
public VipCheck(playerid)
{
new idx = 0;
while(idx < sizeof(VipInfo))
{
if(strcmp(VipInfo[idx][vNick],PlayerName(playerid), true ) == 0 )
{
return 1;
}
idx++;
}
return 0;
}
forward LoadVip();
forward SaveVip();
public SaveVip()
{
new idx;
new File: file2;
while (idx < sizeof(VipInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%s,%d\n",VipInfo[idx][vNick],VipInfo[idx][vTipo]);
if(idx == 0)
{
file2 = fopen("Configs/Vips.cfg", io_write);
}
else
{
file2 = fopen("Configs/Vips.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}
pDays,
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;
}
Procure por new PlayerInfo no seu GM e duas linhas antes do };, coloque isto:
Код:
pDays, PHP код:
|