PDA

View Full Version : VIP disabled


KamilPolska
29/06/2019, 10:20 PM
How to make a message once displayed "END VIP!". When the player is on the server and the player's VIP time ends, he shows the message only once "END VIP". Add Timer and public CheckVip?


if(PlayerInfo[playerid][VipTime] >= gettime())
{
SendClientMessage(playerid, -1, "END VIP!!");
}

Koreadars
30/06/2019, 05:50 AM
You can make it like:

if(PlayerInfo[playerid][VipTime] >= gettime() && PlayerInfo[playerid][VipTime] != 0)
{
SendClientMessage(playerid, -1, "END VIP!!");
PlayerInfo[playerid][VipTime] = 0;
}

KamilPolska
30/06/2019, 10:41 AM
Thanks! Did I do it right?


new timervip[MAX_PLAYERS];

timervip[playerid] = SetTimerEx("CheckVIP", true, 1000, "d", playerid);

forward CheckVIP(playerid);
public CheckVIP(playerid)
{
if(PlayerInfo[playerid][VipTime] >= gettime() && PlayerInfo[playerid][VipTime] != 0)
{
SendClientMessage(playerid, -1, "END VIP!");

PlayerInfo[playerid][Vip] = 0;
PlayerInfo[playerid][VipTime] = 0;
}
return 1;
}

DmitriyShift
30/06/2019, 10:46 AM
Thanks! Did I do it right?


new timervip[MAX_PLAYERS];

timervip[playerid] = SetTimerEx("CheckVIP", true, 1000, "d", playerid);

forward CheckVIP(playerid);
public CheckVIP(playerid)
{
if(PlayerInfo[playerid][VipTime] >= gettime() && PlayerInfo[playerid][VipTime] != 0)
{
SendClientMessage(playerid, -1, "END VIP!");

PlayerInfo[playerid][Vip] = 0;
PlayerInfo[playerid][VipTime] = 0;
}
return 1;
}



new timervip[MAX_PLAYERS];

timervip[playerid] = SetTimerEx("CheckVIP", true, 1000, "d", playerid);

forward CheckVIP(playerid);
public CheckVIP(playerid)
{
if(PlayerInfo[playerid][VipTime] >= gettime() && PlayerInfo[playerid][VipTime] != 0)
{
SendClientMessage(playerid, -1, "END VIP!");

PlayerInfo[playerid][Vip] = 0;
PlayerInfo[playerid][VipTime] = 0;
}
return 1;
}

it's better, it'll be better for the server


SetTimerEx("CheckVIP", false, 1000, "d", playerid);

forward CheckVIP(playerid);
public CheckVIP(playerid)
{
if(PlayerInfo[playerid][VipTime] >= gettime() && PlayerInfo[playerid][VipTime] != 0)
{
SendClientMessage(playerid, -1, "END VIP!");

PlayerInfo[playerid][Vip] = 0;
PlayerInfo[playerid][VipTime] = 0;
}
return 1;
}

KamilPolska
30/06/2019, 11:24 AM
Everything works nicely just changed >= on <= When I had a valid VIP, I was shown the message "END VIP!" When logging in. Thanks!

if(PlayerInfo[playerid][VipTime] >= gettime() && PlayerInfo[playerid][VipTime] != 0)