Jump to content
  • 0

pomoc [HELP] SetTimer


Ucker

Dotaz

Čaute mám výplatu zrobenú zatiaľ na test mám timer nastavený na 10s ale keď sa pripojím na server a mám zamestnanie napr 7 tak mi za tých 10s nič nepríde ani správa nič...

Skúšal som aj iný timer čo iba odošle spŕavu ani ten nefungoval :(

 

forward Vyplaty(); ///hore v mode

 

public Vyplaty() /////////////// public nad OnFilterscipt
{
    for(new i=0; i<MAX_PLAYERS; i++)
{
        if(PlayerInfo[playerid][pJob] == 0)
{
GivePlayerMoney(i, 3563);
SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Obdržal si podporu pre nezamestnaných 3 563$.");
}
else if(PlayerInfo[playerid][pJob]==1)
{
GivePlayerMoney(i, 7864);
SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 7 864$.");
}
else if(PlayerInfo[playerid][pJob] == 2)
{
        GivePlayerMoney(i, 7480);
        SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 7 480$.");
}
else if(PlayerInfo[playerid][pJob] == 3)
{
GivePlayerMoney(i, 7503);
SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 7 503$.");
}
else if(PlayerInfo[playerid][pJob] == 4)
{
GivePlayerMoney(i, 5320);
SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 5 320$.");
}
else if(PlayerInfo[playerid][pJob] == 5)
{
GivePlayerMoney(i, 4830);
SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 4830$.");
}
else if(PlayerInfo[playerid][pJob] == 6)
{
GivePlayerMoney(i, 8450);
SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 8450$.");
}
else if(PlayerInfo[playerid][pJob] == 7)
{
GivePlayerMoney(i, 4956);
SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ]Prišla ti výplata 4956$.");
}
}
return 1;
}
 
SetTimer("Vyplaty",10000,true); //timer na začiatku v gamemodeinit

Link to comment
Share on other sites

8 odpovědí na tuto otázku

Recommended Posts

  • 0

 

 

forward Vyplaty(); ///hore v mode
 
public Vyplaty() /////////////// public nad OnFilterscipt
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if(PlayerInfo[i][pJob] == 0)
		{
			GivePlayerMoney(i, 3563);
			SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Obdržal si podporu pre nezamestnaných 3 563$.");
		}
		else if(PlayerInfo[i][pJob]==1)
		{
			GivePlayerMoney(i, 7864);
			SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 7 864$.");
		}
		else if(PlayerInfo[i][pJob] == 2)
		{
			GivePlayerMoney(i, 7480);
			SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 7 480$.");
		}
		else if(PlayerInfo[i][pJob] == 3)
		{
			GivePlayerMoney(i, 7503);
			SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 7 503$.");
		}
		else if(PlayerInfo[i][pJob] == 4)
		{
			GivePlayerMoney(i, 5320);
			SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 5 320$.");
		}
		else if(PlayerInfo[i][pJob] == 5)
		{
			GivePlayerMoney(i, 4830);
			SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 4830$.");
		}
		else if(PlayerInfo[i][pJob] == 6)
		{
			GivePlayerMoney(i, 8450);
			SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ] Prišla ti výplata 8450$.");
		}
		else if(PlayerInfo[i][pJob] == 7)
		{
			GivePlayerMoney(i, 4956);
			SendClientMessage(i, COLOR_BLUE, "[ -- JOBS -- ]Prišla ti výplata 4956$.");
		}
	}
return 1;
}
 
SetTimer("Vyplaty",10000,true); //timer na začiatku v gamemodeinit 

 

 

 

takto to skus.

Edited by arci224
Link to comment
Share on other sites

  • 0

ja som tam mal najskôr všetko s playerid nešlo potom som našiel nejaký help tuna 

for(new i=0; i<MAX_PLAYERS; i++) to tam bolo tak som to dal zmenil na i nešlo

Link to comment
Share on other sites

  • 0
  • Hlavní moderátor
forward Vyplaty();

public Vyplaty()
{
    static const vyplataCastky[8] = {3563,7864,7480,7503,5320,4830,8450,4956};
    for(new i,a=GetPlayerPoolSize();i<=a;i++)
    {
        if(!IsPlayerConnected(i)) continue;
        new str[145];
        format(str,sizeof str,"[ -- JOBS -- ] %s %i$.",PlayerInfo[i][pJob] == 0 ? ("Obdržal si podporu pre nezamestnaných") : ("Prišla ti výplata"),vyplataCastky[PlayerInfo[i][pJob]]);
        SendClientMessage(i,COLOR_BLUE,str);
        GivePlayerMoney(i,vyplataCastky[PlayerInfo[i][pJob]]);
    }
    return 1;
}

Tento kód by měl být funkční, ale tvůj problém bude asi v tom, že máš filterscript, ale časuješ to v OnGameModeInit. Pokud to opravdu máš jako FS, dej tohle:

SetTimer("Vyplaty",10000,true);

Do callbacku OnFilterScriptInit.

Edited by vEnd
  • Líbí se mi to! (+1) 1
Link to comment
Share on other sites

  • 0

Na FS nepracujem PRacujem na Móde teda učím sa a pomaličky vytváram mód....

Skúšal som to ale v§bec ten Timer ako celkovo nejde ako som písal vytvoril som timer ktorý mal posielať každých 10sekúnd Správu: VITAJ... Bol som na servery 2 mionúty a ani jedna správa neprišla...

Link to comment
Share on other sites

  • 0
  • Hlavní moderátor

Jestli děláš na módu, tak pak to nech v OnGameModeInit. Akorát by mě zajímalo, proč máš v poznámce jednou tohle:

/////////////// public nad OnFilterscipt

A pak tohle:

//timer na začiatku v gamemodeinit

Měl by sis v tom udělat trochu pořádek, i v těch poznámkách... Ten kód, co jsem ti poskytl, by měl normálně fungovat, pokud ti nejde (a pokud ti nefungují žádné timery), bude chyba jinde, momentálně mne ale nenapadá, kde. Dej sem ještě ten OnGameModeInit.

Edited by vEnd
Link to comment
Share on other sites

  • 0

 

 

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Unknown");
//SPAWN
AddPlayerClass(0,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(52,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(92,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(91,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(99,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(253,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(200,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(115,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(8,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(7,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(6,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(5,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(4,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(3,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
AddPlayerClass(2,694.9855,-495.8726,16.3359,6.4199,0,0,0,0,0,0);
//VOZIDLA
  AddStaticVehicleEx(453,451.2998000,-254.7998000,0.0000000,0.0000000,158,164,60); //Reefer
AddStaticVehicleEx(453,550.0999800,-245.0000000,0.0000000,0.0000000,254,254,60); //Reefer
AddStaticVehicleEx(453,537.7000100,-245.8999900,0.0000000,0.0000000,254,254,60); //Reefer
AddStaticVehicleEx(596,632.2999900,-608.5000000,16.2000000,0.0000000,-1,-1,60); //Police Car (LSPD)
AddStaticVehicleEx(596,627.9000200,-608.7999900,16.4000000,0.0000000,-1,-1,60); //Police Car (LSPD)
AddStaticVehicleEx(596,623.4000200,-608.2000100,16.9000000,0.0000000,-1,-1,60); //Police Car (LSPD)
AddStaticVehicleEx(599,615.4000200,-596.9000200,17.5000000,272.0000000,-1,-1,60); //Police Ranger
AddStaticVehicleEx(599,614.9000200,-601.5999800,17.3000000,270.0000000,-1,-1,60); //Police Ranger
AddStaticVehicleEx(523,619.5000000,-593.2999900,16.9000000,0.0000000,-1,-1,60); //HPV1000
AddStaticVehicleEx(523,621.7000100,-593.2000100,16.9000000,0.0000000,-1,-1,60); //HPV1000
AddStaticVehicleEx(407,790.0000000,-608.7999900,16.7000000,0.0000000,219,-1,60); //Firetruck
AddStaticVehicleEx(407,797.5000000,-609.0000000,16.7000000,0.0000000,219,-1,60); //Firetruck
AddStaticVehicleEx(490,783.0999800,-607.5999800,16.7000000,0.0000000,75,-1,60); //FBI Rancher
AddStaticVehicleEx(416,852.0999800,-582.7000100,18.5000000,180.0000000,255,254,60); //Ambulance
AddStaticVehicleEx(416,857.5999800,-582.4000200,18.5000000,180.0000000,255,254,60); //Ambulance
AddStaticVehicleEx(416,862.7000100,-582.0999800,18.5000000,180.0000000,255,254,60); //Ambulance
AddStaticVehicleEx(408,639.2999900,-500.1000100,17.1000000,0.0000000,255,255,60); //Trashmaster
AddStaticVehicleEx(408,643.9000200,-499.8999900,17.1000000,0.0000000,255,255,60); //Trashmaster
AddStaticVehicleEx(420,667.0999800,-544.0999800,16.2000000,272.0000000,218,162,60); //Taxi
AddStaticVehicleEx(420,667.0999800,-547.7000100,16.2000000,270.0000000,218,168,60); //Taxi
AddStaticVehicleEx(420,653.2000100,-543.9000200,16.2000000,0.0000000,214,160,60); //Taxi
AddStaticVehicleEx(403,695.9000200,-468.5000000,17.0000000,180.0000000,71,53,60); //Linerunner
AddStaticVehicleEx(514,706.9000200,-467.7999900,17.0000000,180.0000000,32,32,60); //Tanker
AddStaticVehicleEx(515,701.2000100,-467.2000100,17.5000000,180.0000000,102,28,60); //Roadtrain
AddStaticVehicleEx(435,695.7999900,-454.7000100,17.0000000,178.0000000,245,245,60); //Trailer 1
AddStaticVehicleEx(591,701.2999900,-454.0000000,17.0000000,178.0000000,245,245,60); //Trailer 3
AddStaticVehicleEx(450,707.5999800,-452.7000100,17.0000000,180.0000000,245,245,60); //Trailer 2
//OBJEKTY
CreateObject(16502,602.5000000,-245.7000000,1.0000000,0.0000000,0.0000000,350.0000000); //object(cn2_jetty1) (1)
CreateObject(12990,583.4000200,-247.8999900,1.0000000,0.0000000,0.0000000,102.0000000); //object(sw_jetty) (2)
CreateObject(12990,556.2999900,-254.2000000,1.0000000,0.0000000,0.0000000,284.0000000); //object(sw_jetty) (3)
CreateObject(12990,544.7000100,-251.8999900,1.0000000,0.0000000,0.0000000,4.0000000); //object(sw_jetty) (4)
CreateObject(1637,624.4000200,-258.5000000,8.6000000,0.0000000,0.0000000,276.0000000); //object(od_pat_hutb) (1)
CreateObject(1684,624.7000100,-250.7000000,9.3000000,0.0000000,0.0000000,284.0000000); //object(portakabin) (1)
//PICKUPS
policajtpick = CreatePickup(1581, 1, 246.5819,67.3850,1003.6406, -1);
lekarpick = CreatePickup(1581, 1, 852.0768,-600.3849,18.4219, -1);
hasicpick = CreatePickup(1581, 1, 811.3647,-612.2830,16.3359, -1);
taxipick = CreatePickup (1581, 1, 667.0976,-550.9039,16.3359, -1);
smetiarpick = CreatePickup(1581, 1, 649.1736,-499.7939,16.3359, -1);
truckpick = CreatePickup(1581, 1, 690.2369,-468.9008,16.5363, -1);
rybarpick = CreatePickup(1581, 1, 621.3287,-254.8149,8.5064, -1);
//TEXTLABEL//
    Create3DTextLabel("Policajt", COLOR_RED, 246.5819,67.3850,1003.6406, 40.0, 0);
    Create3DTextLabel("Lekár", COLOR_RED, 852.0768,-600.3849,18.4219, 40.0, 0);
    Create3DTextLabel("Hasič", COLOR_RED, 811.3647,-612.2830,16.3359, 40.0, 0);
    Create3DTextLabel("Taxikár", COLOR_RED, 667.0976,-550.9039,16.3359, 40.0, 0);
    Create3DTextLabel("Smetiar", COLOR_RED, 649.1736,-499.7939,16.3359, 400.0, 0);
    Create3DTextLabel("Kamionista", COLOR_RED, 690.2369,-468.9008,16.5363, 40.0, 0);
    Create3DTextLabel("Rybár", COLOR_RED, 621.3287,-254.8149,8.5064, 40.0, 0);
    //TIMERY
    SetTimer("Vyplaty",10000,true);
return 1;
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...