Jump to content
  • 0

materials get/deliver


Question

Posted

Buna seara .

Nu stiu daca aici se posteaza aceasta intrebare , problema.. legata de materials get / deliver

As vrea ca atunci cand un player scrie /materials get 100 sa ii apara un checkpoint unde trebuie sa se duca pentru a scrie /materials deliver .

O seara minunata in continuare ;)

13 answers to this question

Recommended Posts

Posted

Adica va sa zica

COMANDA asta

public OnPlayerSpawn(playerid)

{

    SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);

    return 1;

}

public OnPlayerEnterCheckpoint(playerid)

{

    GivePlayerMoney(playerid, 1000);

    DisablePlayerCheckpoint(playerid);

    return 1;

}

Si inlocuiesc la  : SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);

                          SetPlayerCheckpoint(playerid, ex: coordonatele marcate pe harta);

    GivePlayerMoney(playerid, 1000);

        GivePlayerMoney(playerid, Dar in loc de "1000" ce pun ?

Posted

    GivePlayerMoney(playerid, 1000);

        GivePlayerMoney(playerid, Dar in loc de "1000" ce pun ?

Acel 1000 inseamna,ca atunci cand playerul trece prin checkpoint,ii da 1000$.

Posted

CMD:materials get 100
{
SetPlayerCheckpoint(playerid, x,y,z,3.0);
SendClientMessage(playerid, -1 , "Text");
return 1;
}
CMD:comanda materials deliver
{
if (IsPlayerInCheckpoint(playerid))
{
DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, 1000);
}

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Posted

strcmp poate...nu dini , dini este baza de salvare a datelor oricum...faci acolo if(strcmp, /..) si functiile alea scz yo folosesc doar zcmd si sqlite...deasta nu ma prea descurc cu strcmp si dini

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Posted

[pawn] SCM(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /materials get [ammount]");

return 1;

}

moneys = strval(tmp);

if(moneys < 1 || moneys > 20) { SCM(playerid, COLOR_GREY, "  Numarul pachetului nu poate fi mai mic de 1 sau 20 !"); return 1; }

new price = moneys * 100;

if(GetPlayerMoney(playerid) > price)

{

    format(string, sizeof(string), "* Ati cumparat %d Materials Packages for $%d.", moneys, price);

    SCM(playerid, COLOR_LIGHTBLUE, string);

    GivePlayerMoney(playerid, - price);

    Var[MatsHolding][playerid] = moneys;

}

else

{

    format(string, sizeof(string), "  Nu iti poti permite $%d !", price);

    SCM(playerid, COLOR_GREY, string);

}

    }

    else

    {

        SCM(playerid, COLOR_GREY, "  Nu esti in  Materials Package Building din Los Santos !");

        return 1;

    }

}

else if(strcmp(x_nr,"deliver",true) == 0)

{

    if(PlayerToPoint(3.0,playerid,-2119.5469,-178.5679,35.3203))

    {

        if(Var[MatsHolding][playerid] > 0)

        {

            new payout = (50)*(Var[MatsHolding][playerid]);

            format(string, sizeof(string), "* Fabrica ti-a dat %d Materials pentru %d Materials Packages.", payout, Var[MatsHolding][playerid]);

    SCM(playerid, COLOR_LIGHTBLUE, string);

            PlayerInfo[playerid][pMats] += payout;

            Var[MatsHolding][playerid] = 0;

        }

        else

        {

            SCM(playerid, COLOR_GREY, "  Nu aveti nici un Materials Packages !");

        return 1;

        }

    }

    else

    {

        SCM(playerid, COLOR_GREY, "  Tu nu esti la fabrica de Materiale din San Fierro !");

        return 1;

    }

}

else

{

    SCM(playerid, COLOR_GREY, "  Invalid Materials Name !");

    return 1;

}

}

return 1;

}

[/pawn]

Nu este .

Posted

[pawn]if(strcmp(cmd,"/materials",true)==0)

    {

        if(IsPlayerConnected(playerid))

    {

    if (PlayerInfo[playerid][pJob] != x)

{

    SendClientMessage(playerid,COLOR_GREY,"Ne pare rau dar nu esti Arms Dealer !");

    return 1;

}

new x_nr[256];

x_nr = strtok(cmdtext, idx);

if(!strlen(x_nr)) {

SendClientMessage(playerid, COLOR_GREY, "USAGE: /materials [name]");

SendClientMessage(playerid, COLOR_GREY, "Available names: Get, Deliver.");

return 1;

}

if(strcmp(x_nr,"get",true) == 0)

{

    if(PlayerToPoint(3.0,playerid,1368.2200,-1280.0271,13.5469))

    {

        if(MatsHolding[playerid] >= 10)

        {

            SendClientMessage(playerid, COLOR_GREY, "Ai luat deja un pachet de materiale!");

        return 1;

        }

        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {

SendClientMessage(playerid, COLOR_WHITE, "USAGE: /materials get [ammount]");

return 1;

}

moneys = strval(tmp);

if(moneys < 1 || moneys > 20) { SendClientMessage(playerid, COLOR_GREY, "Numarul pachetului trebuie sa fie intre 1 si 20!"); return 1; }

new price = moneys * 100;

if(GetPlayerCash(playerid) > price)

{

    format(string, sizeof(string), "* Ai cumparat %d Materiale pentru $%d.", moneys, price);

    SendClientMessage(playerid, COLOR_WHITE, string);

    format(string, sizeof(string), "* Dute la checkpointul de pe harta pentru a livra materialele!");

    SendClientMessage(playerid, COLOR_WHITE, string);

    GivePlayerCash(playerid, - price);

    MatsHolding[playerid] = moneys;

    SetPlayerCheckpoint(playerid, 1712.9625,913.9552,10.8203, 3.0);

}

else

{

    format(string, sizeof(string), "Nu iti poti permite $%d !", price);

    SendClientMessage(playerid, COLOR_GREY, string);

}

    }

    else

    {

        SendClientMessage(playerid, COLOR_GREY, "Nu te afli la Materials Get San Fierro!");

        return 1;

    }

}

  else if(strcmp(x_nr,"deliver",true) == 0)

{

    if(PlayerToPoint(3.0,playerid,1712.9625,913.9552,10.8203))

    {

        if(MatsHolding[playerid] > 0)

        {

            new payout = (50)*(MatsHolding[playerid]);

            format(string, sizeof(string), "* Fabrica ti-a dat %d Materials pentru %d Materials Packages.", payout, MatsHolding[playerid]);

    SendClientMessage(playerid, 0x000000FF, string);

            PlayerInfo[playerid][pMats] += payout;

            MatsHolding[playerid] = 0;

                                    DisablePlayerCheckpoint(playerid);

        }

        else

        {

            SendClientMessage(playerid, COLOR_GREY, "Nu ai nici un Material Package!");

        return 1;

        }

    }

    else

    {

        SendClientMessage(playerid, COLOR_GREY, "Nu esti la Fabrica de Materiale din San Fierro!");

        return 1;

    }

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "  Invalid Materials Name !");

    return 1;

}

}

return 1;

}[/pawn]

La  if (PlayerInfo[playerid][pJob] != x)  pui in loc de x id la jobul Arms Dealer!

SI la Get Si Deliver pui tu coordonatele unde sa fie! Si la checkpoint la fel!

[MAP]Noul Cartier - http://www.sa-mp.ro/forum/index.php?topic=31520.0

Posted

Am pus ce mi-ai dat tu ReaxoR.. doar ca am intampinat o problema

Qmx1C2A.png

[img width=500 height=375] xaO1StQ.png

[img width=500 height=375] HOdHfip.png

Daca poti observa am bani destui..

[pawn] {

    format(string, sizeof(string), "Nu iti poti permite $%d !", price);

    SendClientMessage(playerid, COLOR_GREY, string);

}[/pawn]

Posted

[pawn]if(strcmp(cmd,"/materials",true)==0)

    {

        if(IsPlayerConnected(playerid))

    {

    if (PlayerInfo[playerid][pJob] != 9)

{

    SendClientMessage(playerid,COLOR_GREY,"Ne pare rau dar nu esti Arms Dealer !");

    return 1;

}

new x_nr[256];

x_nr = strtok(cmdtext, idx);

if(!strlen(x_nr)) {

SendClientMessage(playerid, COLOR_GREY, "USAGE: /materials [name]");

SendClientMessage(playerid, COLOR_GREY, "Available names: Get, Deliver.");

return 1;

}

if(strcmp(x_nr,"get",true) == 0)

{

    if(PlayerToPoint(3.0,playerid,1368.2200,-1280.0271,13.5469))

    {

        if(MatsHolding[playerid] >= 10)

        {

            SendClientMessage(playerid, COLOR_GREY, "Ai luat deja un pachet de materiale!");

        return 1;

        }

        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {

SendClientMessage(playerid, COLOR_WHITE, "USAGE: /materials get [ammount]");

return 1;

}

moneys = strval(tmp);

if(moneys < 1 || moneys > 10) { SendClientMessage(playerid, COLOR_GREY, "Numarul pachetului trebuie sa fie intre 1 si 20!"); return 1; }

new price = moneys * 10;

if(GetPlayerCash(playerid) > price)

{

    format(string, sizeof(string), "* Ai cumparat %d Materiale pentru $%d.", moneys, price);

    SendClientMessage(playerid, COLOR_WHITE, string);

    format(string, sizeof(string), "* Dute la checkpointul de pe harta pentru a livra materialele!");

    SendClientMessage(playerid, COLOR_WHITE, string);

    GivePlayerCash(playerid, - price);

    MatsHolding[playerid] = moneys;

    SetPlayerCheckpoint(playerid, 1712.9625,913.9552,10.8203, 3.0);

}

else

{

    format(string, sizeof(string), "Nu iti poti permite $%d !", price);

    SendClientMessage(playerid, COLOR_GREY, string);

}

    }

    else

    {

        SendClientMessage(playerid, COLOR_GREY, "Nu te afli la Materials Get San Fierro!");

        return 1;

    }

}

  else if(strcmp(x_nr,"deliver",true) == 0)

{

    if(PlayerToPoint(3.0,playerid,1712.9625,913.9552,10.8203))

    {

        if(MatsHolding[playerid] > 0)

        {

            new payout = (50)*(MatsHolding[playerid]);

            format(string, sizeof(string), "* Fabrica ti-a dat %d Materials pentru %d Materials Packages.", payout, MatsHolding[playerid]);

    SendClientMessage(playerid, 0x000000FF, string);

            PlayerInfo[playerid][pMats] += payout;

            MatsHolding[playerid] = 0;

                                    DisablePlayerCheckpoint(playerid);

        }

        else

        {

            SendClientMessage(playerid, COLOR_GREY, "Nu ai nici un Material Package!");

        return 1;

        }

    }

    else

    {

        SendClientMessage(playerid, COLOR_GREY, "Nu esti la Fabrica de Materiale din San Fierro!");

        return 1;

    }

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "  Invalid Materials Name !");

    return 1;

}

}

return 1;

}[/pawn]

Incearca asta!

[MAP]Noul Cartier - http://www.sa-mp.ro/forum/index.php?topic=31520.0

Guest
This topic is now closed to further replies.
  • 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.