set time after each hour.
#1

How do I make a check if a hour has passed and eventually it will SetWorldTime
Reply
#2

A timer?
pawn Код:
SetTimer("WorldTimer",1000*60*60,1);//Should be put in OnGameModeInIt call back.
pawn Код:
//If you don't know what this is, put it at the bottom of the script.
forward WorldTimer();
public WorldTimer()
{
SetWorldTimer(0);//Your choice.
}
Reply
#3

but if I start the game mode in , for example: 12:59
the timer won't get that it's 13:00 now because it's only 1 minute.

another question:

I got these commands, but the "No such vehicle." if statement doesn't work.

pawn Код:
CMD:getcar(playerid, params[])
{
    new vehicle, Float:x, Float:y, Float:z;
    if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
    if(sscanf(params,"d",vehicle)) return SyntaxMSG(playerid, "/getcar [vehicleid]");
    if(vehicle > MAX_VEHICLES) return SCM(playerid, -1, "No such vehicle.");
    GetPlayerPos(playerid, x, y, z);
    SetVehiclePos(vehicle, x, y+4, z);
    return 1;
}

CMD:gotocar(playerid, params[])
{
    new vehicle, Float:x, Float:y, Float:z;
    if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
    if(sscanf(params,"d",vehicle)) return SyntaxMSG(playerid, "/gotocar [vehicleid]");
    if(vehicle > MAX_VEHICLES) return SCM(playerid, -1, "No such vehicle.");
    GetVehiclePos(vehicle, x, y, z);
    PutPlayer(playerid, x+1, y+1, z);
    return 1;
}
Reply
#4

pawn Код:
CMD:getcar(playerid, params[])
{
    new vehicle, Float:x, Float:y, Float:z;
    if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
    if(sscanf(params,"d",vehicle)) return SyntaxMSG(playerid, "/getcar [vehicleid]");
    if(vehicle == INVALID_VEHICLE_ID) return SCM(playerid, -1, "No such vehicle.");
    GetPlayerPos(playerid, x, y, z);
    SetVehiclePos(vehicle, x, y+4, z);
    return 1;
}

CMD:gotocar(playerid, params[])
{
    new vehicle, Float:x, Float:y, Float:z;
    if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
    if(sscanf(params,"d",vehicle)) return SyntaxMSG(playerid, "/gotocar [vehicleid]");
    if(vehicle == INVALID_VEHICLE_ID) return SCM(playerid, -1, "No such vehicle.");
    GetVehiclePos(vehicle, x, y, z);
    PutPlayer(playerid, x+1, y+1, z);
    return 1;
}
P.S: For the timer thing, there are some FS's that set player realistic time, take a look at them.
Reply
#5

Lol this doesn't work..l

pawn Код:
CMD:getcar(playerid, params[])
{
    new vehicle, Float:x, Float:y, Float:z;
    if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
    if(sscanf(params,"d",vehicle)) return SyntaxMSG(playerid, "/getcar [vehicleid]");
    if(vehicle == INVALID_VEHICLE_ID) return SCM(playerid, -1, "No such vehicle.");
    GetPlayerPos(playerid, x, y, z);
    SetVehiclePos(vehicle, x, y+4, z);
    SetVehicleVirtualWorld(vehicle, GetPlayerVirtualWorld(playerid));
    LinkVehicleToInterior(vehicle, GetInterior(playerid));
    return 1;
}
it doesn't show the No such vehicle msg.
Reply
#6

PHP код:
CMD:getcar(playeridparams[])
{
    new 
vehicleFloat:xFloat:yFloat:z;
    if(!
CheckAdmin(playeridADMIN_LEVEL_1)) return NotAuthMSG(playerid);
    if(
sscanf(params,"i",vehicle)) return SyntaxMSG(playerid"/getcar [vehicleid]");
    if(
vehicle == INVALID_VEHICLE_ID) return SCM(playerid, -1"No such vehicle.");
    
GetPlayerPos(playeridxyz);
    
SetVehiclePos(vehiclexy+4z);
    
SetVehicleVirtualWorld(vehicleGetPlayerVirtualWorld(playerid));
    
LinkVehicleToInterior(vehicleGetInterior(playerid));
    return 
1;

Reply
#7

I tried with "i", still..
Reply
#8

It's going to look very ugly if the time suddenly jumps an hour forward. You should change it minute-by-minute.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)