[Pomoć] - ServerWeather

Započeo elemental.
11. Jun 2014. Zaključano
342
pregleda
8
postova
Samper
5
Kingpin
11. Jun 2014.
Skripta koju koristim: Moja od 0.
Detaljan opis problema: Imam jedan problem prilikom postavljanja PlayerWeathera. Kada igrač uzme npr. marihuanu, vrijeme mu se postavi na ID 250. Kada završi sa korištenjem, vrijeme mu se treba vratiti na vrijeme koje server koristi, ali se ne vraća
Dio skripte:

new ServerWeather;

forward Weather();
public Weather()
{
new hours, minutes, seconds;
new rand = random(5);
new str;
gettime(hours, minutes, seconds);
if(minutes == 00)
{
if(rand == 1)
{
    SetWeather(10);
    ServerWeather = 10;
    format(str, sizeof(str), "Felictas RolePlay: Now is %d:%d hours.", hours, minutes);
scmta(color_white, str);
    scmta(color_green, "Weather forecast: "col_white"expected weather for next 60 minutes is "col_skyblue"sunny.");
}
else if(rand == 2)
{
    SetWeather(4);
    ServerWeather = 4;
    format(str, sizeof(str), "Felictas RolePlay: Now is %d:%d hours.", hours, minutes);
scmta(color_white, str);
    scmta(color_green, "Weather forecast: "col_white"expected weather for next 60 minutes is "col_skyblue"cloudy.");
}
else if(rand == 3)
{
    SetWeather(16);
    ServerWeather = 16;
    format(str, sizeof(str), "Felictas RolePlay: Now is %d:%d hours.", hours, minutes);
scmta(color_white, str);
    scmta(color_green, "Weather forecast: "col_white"expected weather for next 60 minutes is "col_skyblue"rainy.");
}
else if(rand == 4)
{
    SetWeather(9);
    ServerWeather = 9;
    format(str, sizeof(str), "Felictas RolePlay: Now is %d:%d hours.", hours, minutes);
scmta(color_white, str);
    scmta(color_green, "Weather forecast: "col_white"expected weather for next 60 minutes is "col_skyblue"foggy.");
}
}
return 1;
}

//Korištenje heorina
forward HeroineEffect(playerid);
public HeroineEffect(playerid)
{
    new Float:health;
GetPlayerHealth(playerid);
if(DrugsEffectTimer == 1)
{
DrugsEffectTimer = 2;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 2000, false);
}
else if(DrugsEffectTimer == 2)
{
DrugsEffectTimer = 3;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 3000, false);
}
else if(DrugsEffectTimer == 3)
{
DrugsEffectTimer = 4;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 4000, false);
}
else if(DrugsEffectTimer == 4)
{
DrugsEffectTimer = 5;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 5000, false);
}
else if(DrugsEffectTimer == 5)
{
DrugsEffectTimer = 6;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 5000, false);
}
else if(DrugsEffectTimer == 6)
{
DrugsEffectTimer = 7;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 6000, false);
}
else if(DrugsEffectTimer == 7)
{
DrugsEffectTimer = 8;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 7000, false);
}
else if(DrugsEffectTimer == 8)
{
DrugsEffectTimer = 9;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 8000, false);
}
else if(DrugsEffectTimer == 9)
{
DrugsEffectTimer = 10;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 9000, false);
}
else if(DrugsEffectTimer == 10)
{
DrugsEffectTimer = 11;
SetPlayerHealth(playerid, health+3);
Drugs = SetTimer("DrugsEffect", 10000, false);
}
else if(DrugsEffectTimer == 11)
{
SetPlayerHealth(playerid, health+3);
SetPlayerWeather(playerid, ServerWeather);
KillTimer(Drugs);
}
return 1;
}

// Korištenje marihuane
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
if(SmokingMarihuana == 1)
{
    new Float:health;
    GetPlayerHealth(playerid, health);
    if(TimeSmoked == 1)
    {
        TimeSmoked = 2;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 2)
    {
        TimeSmoked = 3;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 3)
    {
        TimeSmoked = 4;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 4)
    {
        TimeSmoked = 5;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 5)
    {
        TimeSmoked = 6;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 7)
    {
        TimeSmoked = 8;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 9)
    {
        TimeSmoked = 10;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 10)
    {
        TimeSmoked = 11;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 11)
    {
        TimeSmoked = 12;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 12)
    {
        TimeSmoked = 13;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
else if(TimeSmoked == 13)
    {
        TimeSmoked = 14;
        SetPlayerHealth(playerid, health+3);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
            else if(TimeSmoked == 14)
    {
        TimeSmoked = 0;
        SmokingMarihuana = 0;
        SetPlayerHealth(playerid, health+3);
        SetPlayerWeather(playerid, ServerWeather);
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
}
}
}
        return 1;
}

public OnGameModeInit()
{
SetTimer("Weather", 1000, true);
        ServerWeather = 10;
        return 1;
}
Blaeks_Biofor
5
Forum Don
12. Jun 2014.
jednostavno je, tamo gde efekat prestaje, iskoristi ovo http://wiki.sa-mp.com/wiki/SetPlayerWeather
James_SmithXDl
6
OG Legend
12. Jun 2014.
Blaeks wrote on June 12, 2014, 3:57 pm:
jednostavno je, tamo gde efekat prestaje, iskoristi ovo http://wiki.sa-mp.com/wiki/SetPlayerWeather

pa vidis da je iskoristio
SetPlayerWeather(playerid, ServerWeather);


Po meni se kod cini uredu.
dali ti se citava radnja koda izvrsi kako treba?
Blaeks_Biofor
5
Forum Don
12. Jun 2014.
nije to dobro napravljeno, definises skroz gore na vrhu neku varijablu na neutralno, zatim joj stavis pozitivan ishod tek pod ongamemodeinit, sto znaci da ona automatski pri ponovnom njenom koriscenju stavlja neutralan ishod, taj sto je vec nekako aktiviran(primer vreme 250 pri drogiranju)
Samper
5
Kingpin
12. Jun 2014.
Blaeks wrote on June 12, 2014, 4:00 pm:
nije to dobro napravljeno, definises skroz gore na vrhu neku varijablu na neutralno, zatim joj stavis pozitivan ishod tek pod ongamemodeinit, sto znaci da ona automatski pri ponovnom njenom koriscenju stavlja neutralan ishod, taj sto je vec nekako aktiviran(primer vreme 250 pri drogiranju)


Definisao sam na vrhu skripte serverweather, a pogledaj malo bolje kod, na kraju je OnGameModeInit
public OnGameModeInit()
{
SetTimer("Weather", 1000, true);
        ServerWeather = 10;
        return 1;
}
Blaeks_Biofor
5
Forum Don
12. Jun 2014.
procitaj moj predhodni post, molim te
Samper
5
Kingpin
12. Jun 2014.
Blaeks wrote on June 12, 2014, 10:56 pm:
procitaj moj predhodni post, molim te


Nisam skontao. Možeš li malo bolje pojasniti ?
Blaeks_Biofor
5
Forum Don
12. Jun 2014.
ako je varijabla definisana ovako
new varijabla;
to znaci da je to globalna varijabla, koja je neutralna, znaci njen koeficijent je 0, ako me razumes ? moras to ispraviti ovako
new varijabla = broj;
ili jednostavno u funkciji da odredis sama vreme, a ne dzabe da mucis sebe ovim

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha