Jump to content

[Tutorial] Comanda [/Bonus]


[D]aNyel[Regele]

Recommended Posts

Comanda [/Bonus] simpla, cand folosesti comanda /bonus iti  da toate licentele timp de 5 ore.

 

 CMD:bonus(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
            if(PlayerInfo[playerid][pLevel] <= 1)
            {
            GivePlayerCash(playerid,  50000000);
            PlayerInfo[playerid][pLevel] = 5;
            PlayerInfo[playerid][pPremiumPoints] = 100;
            PlayerInfo[playerid][pCarLic] = 1;
            PlayerInfo[playerid][pCarLicT] = 5;               
            PlayerInfo[playerid][pFlyLic] = 1;
            PlayerInfo[playerid][pFlyLicT] = 5;
            PlayerInfo[playerid][pBoatLic] = 1;
            PlayerInfo[playerid][pBoatLicT] = 5;
            PlayerInfo[playerid][pGunLic] = 1;
            PlayerInfo[playerid][pGunLicT] = 5;
            SetPlayerScore(playerid, 5);
            Update(playerid, pCashx);
            UpdateProgress(playerid, 0);
             Update(playerid, pLevelx);
            Update(playerid, pPremiumPointsx);
            Update(playerid,pConnectTimex);
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit $50,000,000 - Acum poti sa iti iei masina!");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit toate licentele timp de 5 ore [/licenses]");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit 100 Premium Points - Acum poti da /shop");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit Level 5"); 
            
        }
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "Nu poti folosi aceasta comanda daca ai level 5+ !");
    }
    return 1;
}

 

 

Edited by [D]aNyel[Regele]
Link to comment
Share on other sites

  • 2 weeks later...
Acum 8 minute, LeonardPWN a spus:

Metode antice..

Ca sa avansam scripturile nu trebuie doar sa radem de cine inca foloseste metode vechi... ar trebui sa ajutam :) aratai tu ce si cum este la moda ca sa poata sa inteleaga data viitoare.

Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte.

Copii nu mai veniti cu vorba de "Am gamemode unic" nu exista asa ceva, la ora actuala totul este pe net.

Aveti grija pe cine ajutati, majoritatea sunt caini.

Link to comment
Share on other sites

  • 3 years later...
On 1/29/2018 at 12:55 PM, [D]aNyel[Regele] said:

Comanda [/Bonus] simpla, cand folosesti comanda /bonus iti  da toate licentele timp de 5 ore.

 

 CMD:bonus(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
            if(PlayerInfo[playerid][pLevel] <= 1)
            {
            GivePlayerCash(playerid,  50000000);
            PlayerInfo[playerid][pLevel] = 5;
            PlayerInfo[playerid][pPremiumPoints] = 100;
            PlayerInfo[playerid][pCarLic] = 1;
            PlayerInfo[playerid][pCarLicT] = 5;               
            PlayerInfo[playerid][pFlyLic] = 1;
            PlayerInfo[playerid][pFlyLicT] = 5;
            PlayerInfo[playerid][pBoatLic] = 1;
            PlayerInfo[playerid][pBoatLicT] = 5;
            PlayerInfo[playerid][pGunLic] = 1;
            PlayerInfo[playerid][pGunLicT] = 5;
            SetPlayerScore(playerid, 5);
            Update(playerid, pCashx);
            UpdateProgress(playerid, 0);
             Update(playerid, pLevelx);
            Update(playerid, pPremiumPointsx);
            Update(playerid,pConnectTimex);
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit $50,000,000 - Acum poti sa iti iei masina!");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit toate licentele timp de 5 ore [/licenses]");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit 100 Premium Points - Acum poti da /shop");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit Level 5"); 
            
        }
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "Nu poti folosi aceasta comanda daca ai level 5+ !");
    }
    return 1;
}

 

 

misto +1 dela mine dar am o intrebare ce pot sa fac la erroarea asta

D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33194) : warning 202: number of arguments does not match definition
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33200) : warning 202: number of arguments does not match definition
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33213) : warning 202: number of arguments does not match definition
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33214) : warning 217: loose indentation
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33215) : warning 217: loose indentation
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33223) : warning 217: loose indentation
Pawn compiler 3.10.8              Copyright (c) 1997-2006, ITB CompuPhase

Header size:          45700 bytes
Code size:          4065012 bytes
Data size:         43014596 bytes
Stack/heap size:     262144 bytes; estimated max. usage=12650 cells (50600 bytes)
Total requirements:47387452 bytes

6 Warnings.
[Finished in 26.1s]

Link to comment
Share on other sites

Este ok doar ca:

1.poti sa nu m-ai folosesti OnPlayerUpdate pentru ca sincer mi se pare inutil si sa folosesti direct acolo in comanda(poti sa folosesti si un stock).

2.In functia de GivePlayerMoney poti sa-i setezi banii adaugand la PlayerInfo[playerid][pMoney], la fel ca si la nivel.

3.De ce folosesti IsPlayerConnected? poti folosii un bool de gPlayerLogged daca ai un tutorial pe server.

4.De ce folosesti mai multe functii pentru sendclient? poti sa folosesti odata sau de 2ori nu-i nevoie de 3000 de linii dar infine.

5.Aranjeaza putin codul ala ca arata oribil parerea mea.

Bonus - 6. Poti sa adaugi si o variabila new randomlucru = 5+ random(20); daca vrei sa primesti o suma de bani random si nu fixa..

Link to comment
Share on other sites

9 minutes ago, Serban said:

Este ok doar ca:

1.poti sa nu m-ai folosesti OnPlayerUpdate pentru ca sincer mi se pare inutil si sa folosesti direct acolo in comanda(poti sa folosesti si un stock).

2.In functia de GivePlayerMoney poti sa-i setezi banii adaugand la PlayerInfo[playerid][pMoney], la fel ca si la nivel.

3.De ce folosesti IsPlayerConnected? poti folosii un bool de gPlayerLogged daca ai un tutorial pe server.

4.De ce folosesti mai multe functii pentru sendclient? poti sa folosesti odata sau de 2ori nu-i nevoie de 3000 de linii dar infine.

5.Aranjeaza putin codul ala ca arata oribil parerea mea.

Bonus - 6. Poti sa adaugi si o variabila new randomlucru = 5+ random(20); daca vrei sa primesti o suma de bani random si nu fixa..

Multumesc de raspuns dar am alta problema orce comanda /bonus fac numi da bani dc?

Link to comment
Share on other sites

5 minutes ago, Serban said:

@silviuYT2006 

1.ce functie ai aplicat? GivePlayerMoney sau GivePlayerCash?

2.Cum ai enumul? PlayerInfo[playerid][pMoney] sau altceva?

3.Ai facut salvarea in baza de date?

asa e bun?

YCMD:bonus(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
            if(PlayerInfo[playerid][pLevel] <= 1)
            {
            PlayerInfo[playerid][pLevel] = 5;
            PlayerInfo[playerid][pPremiumPoints] = 100;
            PlayerInfo[playerid][pCarLic] = 1;
            PlayerInfo[playerid][pCarLicT] = 5;               
            PlayerInfo[playerid][pFlyLic] = 1;
            PlayerInfo[playerid][pFlyLicT] = 5;
            PlayerInfo[playerid][pBoatLic] = 1;
            PlayerInfo[playerid][pBoatLicT] = 5;
            PlayerInfo[playerid][pGunLic] = 1;
            PlayerInfo[playerid][pGunLicT] = 5;
            PlayerInfo[playerid][pMoney] = 50000000
            SetPlayerScore(playerid, 5);
            Update(playerid, pCashx);
            UpdateProgress(playerid, 0);
             Update(playerid, pLevelx);
            Update(playerid, pPremiumPointsx);
            Update(playerid,pConnectTimex);
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit $50,000,000!");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit toate licentele timp de 5 ore [/licenses]");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit 100 Premium Points - Acum poti da /shop");
            SendClientMessage(playerid, COLOR_LIGHTRED, "Ai primit Level 5");
            
        }
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "Nu poti folosi aceasta comanda daca ai level 5+ !");
    }
    return 1;
}

Link to comment
Share on other sites

7 minutes ago, Serban said:

@silviuYT2006 

1.ce functie ai aplicat? GivePlayerMoney sau GivePlayerCash?

2.Cum ai enumul? PlayerInfo[playerid][pMoney] sau altceva?

3.Ai facut salvarea in baza de date?

nu prea ma descurc de oare ce sunt incepator abea invat sa scriptez 😔

dar orcum vezi daca e bun editu

 

Link to comment
Share on other sites

@silviuYT2006

Daca ar fi dupa mine ar fi asa(nu stiu daca are erori e doar un exemplu):

CMD:bonus(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] > 1) return SendClientMessage(playerid, -1, "eroare ai peste level 1");

    new randmoney = 500+ random(10000), string[128];
    PlayerInfo[playerid][pMoney] = randmoney;
    ResetPlayerMoney(playerid), GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
    PlayerInfo[playerid][pLevel] = 3, SetPlayerScore(playerid, 3);
    PlayerInfo[playerid][pPremiumPoints] = 100;
    format(string, sizeof string, "Server: Ai primit %d bani, nivel 3 si 100 de premium points ca bonus", randmoney);
    SendClientMessage(playerid, -1, string);
    mysql_format(SQL, query, sizeof query, "update conturi set money = '%d', level = '%d', premiumpoints = '%d' where name = '%s'",                       PlayerInfo[playerid][pMoney],  PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pPremiumpoints], GetName(playerid));
    mysql_tquery(SQL, query);
    return true;
}


 

Edited by Serban
corectie
Link to comment
Share on other sites

1 minute ago, Serban said:

@silviuYT2006

Daca ar fi dupa mine ar fi asa(nu stiu daca are erori e doar un exemplu):

CMD:bonus(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] > 1) return SendClientMessage(playerid, -1, "eroare ai peste level 1");

    new randmoney = 500+ random(10000);
    PlayerInfo[playerid][pMoney] = randmoney;
    ResetPlayerMoney(playerid), GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
    PlayerInfo[playerid][pLevel] = 3, SetPlayerScore(playerid, 3);
    PlayerInfo[playerid][pPremiumPoints] = 100;
    format(string, sizeof string, "Server: Ai primit %d bani, nivel 3 si 100 de premium points ca bonus", randmoney);
    SendClientMessage(playerid, -1, string);
    mysql_format(SQL, query, sizeof query, "update conturi set money = '%d', level = '%d', premiumpoints = '%d' where name = '%s'", PlayerInfo[playerid][pMoney],        PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pPremiumpoints], GetName(playerid));
    mysql_tquery(SQL, query);
    return true;
}
 

il bag in gamemode il testez si revin

Link to comment
Share on other sites

4 minutes ago, Serban said:

@silviuYT2006

Daca ar fi dupa mine ar fi asa(nu stiu daca are erori e doar un exemplu):

CMD:bonus(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] > 1) return SendClientMessage(playerid, -1, "eroare ai peste level 1");

    new randmoney = 500+ random(10000);
    PlayerInfo[playerid][pMoney] = randmoney;
    ResetPlayerMoney(playerid), GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
    PlayerInfo[playerid][pLevel] = 3, SetPlayerScore(playerid, 3);
    PlayerInfo[playerid][pPremiumPoints] = 100;
    format(string, sizeof string, "Server: Ai primit %d bani, nivel 3 si 100 de premium points ca bonus", randmoney);
    SendClientMessage(playerid, -1, string);
    mysql_format(SQL, query, sizeof query, "update conturi set money = '%d', level = '%d', premiumpoints = '%d' where name = '%s'", PlayerInfo[playerid][pMoney],        PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pPremiumpoints], GetName(playerid));
    mysql_tquery(SQL, query);
    return true;
}
 

D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33194) : warning 202: number of arguments does not match definition
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33199) : error 017: undefined symbol "pMoney"
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33199) : warning 215: expression has no effect
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33200) : error 017: undefined symbol "pMoney"
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33203) : error 017: undefined symbol "string"
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33203) : error 017: undefined symbol "string"
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33204) : error 017: undefined symbol "string"
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33205) : error 017: undefined symbol "query"
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33205) : error 017: undefined symbol "query"
D:\Users\silviu\Desktop\Chars Gamemode\gamemodes\Chars.pwn(33206) : error 017: undefined symbol "query"
Pawn compiler 3.10.8              Copyright (c) 1997-2006, ITB CompuPhase


8 Errors.
[Finished in 24.4s with exit code 1]
[cmd: ['pawncc.exe', '-i includes', 'D:\\Users\\silviu\\Desktop\\Chars Gamemode\\gamemodes\\Chars.pwn', '-;+', '-Z+', '-r', '-d3']]
[dir: D:\Users\silviu\Desktop\Chars Gamemode\gamemodes]
[path: D:\Program Files\Common Files\Microsoft Shared\Windows Live;D:\Program Files\Common Files\Oracle\Java\javapath;D:\Program Files\NVIDIA Corporation\PhysX\Common;D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;D:\Windows\system32;D:\Program Files\Common Files\Microsoft Shared\Windows Live

 

nu merge

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.