Jump to content
  • 0

GETGIFT PROBLEM


OscarJoaca

Question

Problema intalnita (descriere): Am un bug la getgift, poti da de cate ori vrei... Si vreau sa fac sa poti da o data la 2 ore...
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu): 

CMD:getgift(playerid, params[])
{
   if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te loghezi  mai intai.");
   if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid,COLOR_WHITE,"{37B9C8}Please get out of the car.");
   if(!IsPlayerInRangeOfPoint(playerid, 7.0, 1516.1532,-1655.5228,13.5392))  return SCM(playerid,COLOR_WHITE, "Nu esti la locul unde poti folosi [/getgift] (LSPD).");

   {
       {
            new Random = random(6);
            switch(Random)
            {
                case 0:
                {
                    GivePlayerCash(playerid,25000);
                    Update(playerid,pCashx);
                    SendClientMessage(playerid, COLOR_WHITE, "Felicitari!Ai castigat 25.000$");
                }
                case 1:
                {
                      SendClientMessage(playerid, COLOR_WHITE, "Felicitari!Ai castigat 5 ppoints");
                   }
                case 2:
                {
                    PlayerInfo[playerid][pMats] += 50000;
                    Update(playerid,pMatsx);
                    SendClientMessage(playerid, COLOR_WHITE, "Felicitari!Ai castigat 50000 materiale");
                }
                case 3:
                {
                    PlayerInfo[playerid][pDrugs] += 10;
                    new wakaname[25],str2[128];
                    GetPlayerName(playerid,wakaname,sizeof(wakaname));
                    format(str2,sizeof(str2),"UPDATE users SET `Drugs`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pDrugs],wakaname);
                    mysql_query(SQL,str2);
                    SendClientMessage(playerid, COLOR_WHITE, "Felicitari!Ai castigat 10 grame de droguri");
                }
                case 4:
                {
                    PlayerInfo[playerid][pExp] += 2;
                    SendClientMessage(playerid, COLOR_WHITE, "Felicitari!Ai castigat 2 respect points");
                }
                case 5:
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Felicitari!Ai castigat inca 2 cadouri!");
                }
            }
        }
   }
   return 1;
}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da, dar nu am reusit sa fac un timer... Tin sa mentionez ca am GM-ul Saints.

Edited by OscarJoaca
Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Defineste o variabila la inceputul gamemode-ului , de exemplu :

new TimerGetGift[MAX_PLAYERS];

La "public OnPlayerConnect" vei adauga :

TimerGetGift[playerid] = 0;

La comanda /getgift , la inceput , vei adauga asa :

if(TimerGetGift[playerid] >= 1)
{ 
    SendClientMessage(playerid, -1, "Ai luat deja un cadou, trebuie sa astepti doua ore !");
    return 1;
}

Apoi urmeaza ca la fiecare case primit sa adaugi urmatoarea linie :

TimerGetGift[playerid] = 1;
SetTimerEx("NewGetGift", 7200000, false, "i", playerid);

Asa vei adauga la fiecare case la care vrei sa se adauge timer-ul .

Acum, undeva mai jos, vei face un public de genul :

forward NewGetGift();
public NewGetGift()
{
    TimerGetGift[playerid] = 0;
}

Cam asta e ceea ce ai de facut .

 

Sa-ti explic acum niste lucruri :

1.TimerGetGift poate fi inlocuit cu orice variabila vrei tu, eu ti-am dat un exemplu , tu poti pune orice in loc de TimerGetGift .

2.TimerGetGift[playerid] = 0; inseamna ca player-ul nu a luat cadou si il va lasa sa foloseasca comanda /getgift .

3.TimerGetGift[playerid] = 1; inseamna ca player-ul a luat cadou si nu il va lasa sa foloseasca comanda /getgift daca adaugi linia pe care ti-am dat-o mai sus .

4.SetTimerEx("NewGetGift", 7200000, false, "i", playerid); este timer-ul de 2 ore setat pentru player-ul care a dat /getgift , acel false inseamna ca timer-ul nu se repeta dupa doua ore, ceea ce-i ofera player-ului posibilitatea sa dea /getgift din nou .

5.public NewGetGift(); este functia care dupa doua ore ii va seta player-ului variabila "TimerGetGift[playerid]" la 0, adica player-ul va putea da /getgift iar dupa ce trece timer-ul explicat mai sus . In loc de NewGetGift tu vei putea pune orice doresti , eu am pus un exemplu . Dar ai grija, daca schimbi numele de la public, sa-l schimbi si de la forward .

 

Iti urez mult succes !

Edited by NoNamed
Link to comment
Share on other sites

  • 0

Defineste o variabila la inceputul gamemode-ului , de exemplu :

new TimerGetGift[MAX_PLAYERS];

La "public OnPlayerConnect" vei adauga :

TimerGetGift[playerid] = 0;

La comanda /getgift , la inceput , vei adauga asa :

if(TimerGetGift[playerid] >= 1)
{ 
    SendClientMessage(playerid, -1, "Ai luat deja un cadou, trebuie sa astepti doua ore !");
    return 1;
}

Apoi urmeaza ca la fiecare case primit sa adaugi urmatoarea linie :

TimerGetGift[playerid] = 1;
SetTimerEx("NewGetGift", 7200000, false, "i", playerid);

Asa vei adauga la fiecare case la care vrei sa se adauge timer-ul .

Acum, undeva mai jos, vei face un public de genul :

forward NewGetGift();
public NewGetGift()
{
    TimerGetGift[playerid] = 0;
}

Cam asta e ceea ce ai de facut .

 

Sa-ti explic acum niste lucruri :

1.TimerGetGift poate fi inlocuit cu orice variabila vrei tu, eu ti-am dat un exemplu , tu poti pune orice in loc de TimerGetGift .

2.TimerGetGift[playerid] = 0; inseamna ca player-ul nu a luat cadou si il va lasa sa foloseasca comanda /getgift .

3.TimerGetGift[playerid] = 1; inseamna ca player-ul a luat cadou si nu il va lasa sa foloseasca comanda /getgift daca adaugi linia pe care ti-am dat-o mai sus .

4.SetTimerEx("NewGetGift", 7200000, false, "i", playerid); este timer-ul de 2 ore setat pentru player-ul care a dat /getgift , acel false inseamna ca timer-ul nu se repeta dupa doua ore, ceea ce-i ofera player-ului posibilitatea sa dea /getgift din nou .

5.public NewGetGift(); este functia care dupa doua ore ii va seta player-ului variabila "TimerGetGift[playerid]" la 0, adica player-ul va putea da /getgift iar dupa ce trece timer-ul explicat mai sus . In loc de NewGetGift tu vei putea pune orice doresti , eu am pus un exemplu . Dar ai grija, daca schimbi numele de la public, sa-l schimbi si de la forward .

 

Iti urez mult succes !

Multumesc!

Am intalnit niste errori:

\\psf\Home\Desktop\Serioux RPG V0.5I\Serioux RPG V0.5I\gamemodes\serioux.pwn(17064) : warning 217: loose indentation
\\psf\Home\Desktop\Serioux RPG V0.5I\Serioux RPG V0.5I\gamemodes\serioux.pwn(17070) : warning 217: loose indentation
\\psf\Home\Desktop\Serioux RPG V0.5I\Serioux RPG V0.5I\gamemodes\serioux.pwn(17078) : warning 217: loose indentation
\\psf\Home\Desktop\Serioux RPG V0.5I\Serioux RPG V0.5I\gamemodes\serioux.pwn(17089) : warning 217: loose indentation
\\psf\Home\Desktop\Serioux RPG V0.5I\Serioux RPG V0.5I\gamemodes\serioux.pwn(17096) : warning 217: loose indentation
\\psf\Home\Desktop\Serioux RPG V0.5I\Serioux RPG V0.5I\gamemodes\serioux.pwn(42264) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

 

Eu am definit playerid, nush dece nu vrea sa-l citeasca in situatia asta "    TimerGetGift[playerid] = 0;"

Link to comment
Share on other sites

  • 0

@NoNamed, nu ma pricep eu foarte bine, dar acel timer nu este facut pe playerid? Adica un player(playerid = 1) isi ia /getgift, iese de pe server si intra altul, care primeste playerid=1. Acest nou jucator poate folosi comanda?

Nu mai deschideti in pu*a mea servere de SA:MP !

Jucati-va pe cele care sunt !   Sunt suficiente !

Reguli de bun simt:

1. Nu faceti reclama unde nu trebuie !

2. Nu injurati ca la usa cortului !

3. Daca esti analfabeti, taci din gura !

4. Nu abuza de 'scuze', 'din greseala' !

 

My work ::: http://pastebin.com/VRNRcaAs

Link to comment
Share on other sites

  • 0

Nu ai asezat bine codul , primele warning-uri iar la cel cu playerid, arata-mi linia .

Revolvat faza cu warning-urile

 

\\psf\Home\Desktop\Serioux RPG V0.5I\Serioux RPG V0.5I\gamemodes\serioux.pwn(42264) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Linia: 

    TimerGetGift[playerid] = 0;

Link to comment
Share on other sites

  • 0

Revolvat faza cu warning-urile

 

\\psf\Home\Desktop\Serioux RPG V0.5I\Serioux RPG V0.5I\gamemodes\serioux.pwn(42264) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Linia: 

    TimerGetGift[playerid] = 0;

forward NewGetGift(playerid);
public NewGetGift(playerid)
{
    TimerGetGift[playerid] = 0;
}

Nu mai deschideti in pu*a mea servere de SA:MP !

Jucati-va pe cele care sunt !   Sunt suficiente !

Reguli de bun simt:

1. Nu faceti reclama unde nu trebuie !

2. Nu injurati ca la usa cortului !

3. Daca esti analfabeti, taci din gura !

4. Nu abuza de 'scuze', 'din greseala' !

 

My work ::: http://pastebin.com/VRNRcaAs

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Similar Content

    • By r3f13x
      Salut, Am si eu o problema, daca se pricepe cineva poate ma ajuta si pe mine. 
      De la un timp am o eroare la forum si nu stiu de ce, asa random. 
      Daca ma poate ajuta cineva.
       
      "Some functions are enabled on your server which have the potential to cause serious damage to your community or server. If you are in a shared hosting environment, some of these functions may bypass the restrictions which prevent one account on the server affecting another. Their presence also increases the amount of damage that could be caused if your AdminCP is compromised.
      Since Invision Community, and most other web applications do not use these functions, we recommend disabling them on your server, at least within the directory that your community is installed in. You should contact your hosting provider or system administrator and ask them to be added to the disable_functions PHP setting.
      [10:59 AM]
      la setarea PHP disable_functions." 
       
    • By EdySt
      Am si eu o problema, cand compilez un gm burned sau adaug un progress bar cv 
      D:\DinC\Desktop\gamemodes\L-GM.pwn(42) : fatal error 100: cannot read from file
      cand compilez cu pawn citeste, dc?
      Apropo, pawn cu care compileaza sublime am incercat sa-l sterg si sa-l pun pe asta, dar la fel tot  nu citeste
    • By Funnk
      Ma poate ajuta cineva cu aceste erori/warning-uri?
      E:\pawno\include\mSelection.inc(207) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\mSelection.inc(222) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\mSelection.inc(426) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\mSelection.inc(556) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\fly.inc(45) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\fly.inc(45) : warning 219: local variable "y" shadows a variable at a preceding level
      E:\pawno\include\fly.inc(60) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\fly.inc(60) : warning 219: local variable "y" shadows a variable at a preceding level
      E:\pawno\include\fly.inc(108) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\fly.inc(108) : warning 219: local variable "y" shadows a variable at a preceding level
      E:\pawno\include\OPA.inc(57) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\OPA.inc(58) : warning 219: local variable "y" shadows a variable at a preceding level
      E:\pawno\include\OPA.inc(142) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
      E:\pawno\include\OPA.inc(144) : warning 219: local variable "x" shadows a variable at a preceding level
      E:\pawno\include\OPA.inc(145) : warning 219: local variable "y" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(46) : error 017: undefined symbol "AntiDeAMX"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(2955) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(4763) : error 004: function "vUpdate" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(4874) : warning 219: local variable "y" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(4874) : warning 219: local variable "h" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(4893) : warning 219: local variable "y" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(4893) : warning 219: local variable "h" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(4902) : error 004: function "SS" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(4962) : error 004: function "SS" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5013) : error 004: function "ProxDetector" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5166) : error 004: function "SS" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5168) : error 004: function "SS" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5185) : error 004: function "SS" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5344) : error 017: undefined symbol "PutPlayerInVehicleEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5363) : error 017: undefined symbol "PutPlayerInVehicleEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5382) : error 017: undefined symbol "PutPlayerInVehicleEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5401) : error 017: undefined symbol "PutPlayerInVehicleEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(5420) : error 017: undefined symbol "PutPlayerInVehicleEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(6054) : warning 219: local variable "health" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(6056) : error 017: undefined symbol "GetPlayerHealthEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(6061) : error 017: undefined symbol "SetPlayerHealthEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(6065) : error 017: undefined symbol "SetPlayerHealthEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(6494) : error 017: undefined symbol "SetPlayerPosEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(6725) : error 004: function "SS" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(7234) : warning 219: local variable "x" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(7234) : warning 219: local variable "y" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(7619) : warning 219: local variable "health" shadows a variable at a preceding level
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(7622) : error 017: undefined symbol "GetPlayerHealthEx"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(7627) : error 017: undefined symbol "Carspeed"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(8360) : error 017: undefined symbol "NumIp"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(8368) : error 017: undefined symbol "AntiFlood_InitPlayer"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(10084) : error 017: undefined symbol "ClearWanted"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(10112) : error 017: undefined symbol "BanCheck"
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(10247) : error 004: function "CrimInRange" is not implemented
      C:\Users\Crysty\Desktop\gamemode sa\gamemode sa\gamemodes\engame.pwn(10470) : error 017: undefined symbol "SetPlayerArmourEx"
      Compilation aborted.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase

      26 Errors.
      Asa arata comanda inainte sa o modific si dupa ce am moficat-o:
      https://pastebin.com/rDN4eMrn
    • By Funnk
      Salut, am si eu o problema  la comanda /towcar
      Am aceasta comanda in pawno https://pastebin.com/a271BXPZ
      Cand dau compilare imi arata asa https://imgur.com/a/YzJCh
      Ce pot face?
    • By SPAWN
      Salut,
       
      Tocmai ce am descarcat si eu serverul Burned RPG sa-l testez .. nu am mai jucat SA:MP de mult dar acest server ma face sa-l testez sa-l descopar.
      Nu vreau sa-mi deschid server sau sa profit ca in primul rand nu am cunostintele necesare, vreau doar sa-l pornesc si sa-l testez sa vad cum este.
      Ei bine am cerut un host timp de 24h de la o firma, am pus serverul pe FTP tot frumos, am schimbat datele in Pawno cu cele de mySQL si cand ii dau drumul porneste serverul dar cand intru si incep sa ma inregistrez, introduc prima oara parola dupa care dau sa ma loghez si imi zice ca parola este gresita. Am verificat si serverul nu se conecteaza la baza de date dar nu inteleg de ce se intampla treaba asta ca eu zic ca am facut totul ca la carte.
      Linia in pawno este modificata cum trebuie: if(SERVER_HOSTSTATUS == 1) SQL = mysql_connect("188.214.58.6", "aidinm", "zp_hid11310", "parolamysql")
       
      Eroarea din mySQL_Log
      [22:16:11] [ERROR] CMySQLQuery::Execute[()] - (error #2006) MySQL server has gone away [22:16:11] [ERROR] CMySQLConnection::Connect - (error #1044) Access denied for user 'aidinm'@'%' to database 'zp_hid11310' Eroarea din server_log
      [22:16:11]  =======================================  [22:16:11]  |                                     |  [22:16:11]  |        YSI version 3.09.0684        |  [22:16:11]  |        By Alex "Y_Less" Cole        |  [22:16:11]  |                                     |  [22:16:11]  =======================================  [22:16:11]   [22:16:11] Server: 188.214.58.24 [22:16:11] Server vehicles: 0 [22:16:11] Safezones: 0 [22:16:11] Houses: 0 [22:16:11] Clans: 0 [22:16:11] Clan zones: 0 [22:16:11] Bussines: 0 [22:16:11] Turfs: 0 [22:16:11] Factions: 0 [22:16:11] Jobs: 0 [22:16:11] Furnitures: 0 [22:16:11] Stuff Loaded [22:16:11] Safes: 0 [22:16:11] Number of vehicle models: 18 [22:16:11] ==================================================================== [22:16:11] Error ID: 2006, Error: MySQL server has gone away [22:16:11] Callback: LoadDSVeh [22:16:11] gQuery: SELECT * FROM `dsveh` [22:16:11] ====================================================================  
      Multumesc frumos, sper totusi sa primesc sprijin!
       
      Succes!
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.