public OnPlayerGameTime(playerid, hour, minute, second)
{
if(hour >= 1 && !minute && !second)
{
// You have played for X hour:00:00
}
}
JakAdmin3_OnPlayerGameTime(playerid, hour, minute, second)
{
}
public OnPlayerGameTime(playerid, hour, minute, second);
How do you make something like
PHP код:
Structure in the script PHP код:
PHP код:
|
stock GetPlayerOnLine(playerid){ new sec,mins,hours,string[40]; sec = (NetStats_GetConnectedTime(playerid)/1000)%60; mins = (NetStats_GetConnectedTime(playerid)/60000)%60; hours = (NetStats_GetConnectedTime(playerid)/3600000); format(string,sizeof(string),"Time: %02d:%02d:%02d",hours,mins,sec); SendClientMessage(playerid, -1,string); return true; }
public OnPlayerGameTime(playerid, hour, minute, second)
{
if(hour >= 1 && !minute && !second)
{
// You have played for X hour:00:00
}
}
JakAdmin3_OnPlayerGameTime(playerid, User[playerid][accountGame][2], User[playerid][accountGame][1], User[playerid][accountGame][0])
{
return 1;
}
function:check_playingtime(playerid, &hour, &minute, &second)
{
hour = User[playerid][accountGame][2];
minute = User[playerid][accountGame][1];
second = User[playerid][accountGame][0];
return 1;
}
stock GetPlayerGameTime(playerid, &hour, &minute, &second)
{
return CallRemoteFunction("check_playingtime", "dddd", playerid, hour, minute, second);
}
CMD:checktime(playerid, params[])
{
new string[92], x[3];
GetPlayerGameTime(playerid, x[0], x[1], x[2]);
format(string, sizeof(string), "Total Playing Time: %02d:%02d:%02d", x[0], x[1], x[2]);
SendClientMessage(playerid, -1, string);
return 1;
}
hook OnPlayerUpdate(playerid)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
for(new i = sizeof(PayNSprayPos) - 1; i >= 0; i--)
{
if(IsPlayerInRangeOfPoint(playerid, 3.3, PayNSprayPos[i][0], PayNSprayPos[i][1], PayNSprayPos[i][2]) && GetPlayerMoney(playerid) >= 100)
{
static
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
if(p_A_Flood[playerid] < gettime())
p_Timer[playerid] = SetTimerEx("Ji_Timer_PNS", 100, true, "iifff", playerid, GetPlayerVehicleID(playerid), x, y, z);
}
}
}
}
forward Ji_Timer_PNS(playerid, vehicleid, Float:x, Float:y, Float:z);
public Ji_Timer_PNS(playerid, vehicleid, Float:x, Float:y, Float:z)
{
static
Float:Pos[3],
Float:vHP;
GetVehicleHealth(vehicleid, vHP);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
if(x == Pos[0] && y == Pos[1] && z == Pos[2])
{
if(p_A_Flood[playerid] > gettime())
return 1;
new a = v_Color1[vehicleid] ? -1 : random(255),
b = v_Color2[vehicleid] ? -1 : random(255);
p_A_Flood[playerid] = gettime() + TEMPS_MOYEN;
p_Timer[playerid] = 0;
KillTimer(p_Timer[playerid]);
if(!v_Color1[vehicleid] && !v_Color2[vehicleid])
{
ChangeVehicleColor(vehicleid, a, b);
}
vHP = 1000.0 - vHP;
CallLocalFunction("Ji_OnCarResprayAtPNS", "iiiif", playerid, GetPlayerVehicleID(playerid), a, b, vHP <= 0.00 ? 0.00 : vHP);
}
return 1;
}
forward Ji_OnCarResprayAtPNS(playerid, vehicleid, color1, color2, Float:hp_recovered);
public Ji_OnCarResprayAtPNS(playerid, vehicleid, color1, color2, Float:hp_recovered)
{
AdminWarn("[DEBUG] playerid: %i, vehicleid: %i, color1: %i, color2: %i, hp_recovered: %0.3f", playerid, vehicleid, color1, color2, hp_recovered);
if(hp_recovered > 280.0)
{
foreach(new i : Player)
{
if(i == playerid || !IsPlayerInAnyVehicle(i))
continue;
if(GetPlayerVehicleID(i) == vehicleid)
{
SCM(i, 0xff00ffff, "[REPARATION] {e699ff}Your have to pay 100$ too.");
GivePlayerMoney(i, -100);
}
}
}
return 1;
}
Dayrion, wrong thread?
JaKe, PVars are slow? Can you support this claim with relevant benchmarks pertaining to your situation? ![]() |
Dayrion, wrong thread?
JaKe, PVars are slow? Can you support this claim with relevant benchmarks pertaining to your situation? ![]() |
If it's FS, then CallRemoteFunction, if include, CallLocalFunction.
|
CallRemoteFunction(const function[], const format[], {Float,_}:...) CallLocalFunction(const function[], const format[], {Float,_}:...)
CallLocalFunction("Ji_OnCarResprayAtPNS", "iiiif", playerid, GetPlayerVehicleID(playerid), a, b, vHP <= 0.00 ? 0.00 : vHP);