Jump to content

[Tutorial] Cum arata comanda "/order "?


KruZZel
 Share

Recommended Posts

Dupa cum spune si titlul, va voi arata cum arata comanda "/order".

Comanda arata cam asa:

 

if(strcmp(cmd, "/order", true) == 0)

{

new x_order[256];

x_order= strtok(cmdtext, idx);

if(!strlen(x_order))
{

           SendUsage(playerid,"/order [1-6]");
           SendClientMessage(playerid, COLOR_WHITE, "/order 1 - deagle, /order 2 - shoutgun, /order 3 m4, /order 4 - mp5, /order 5 - ak47, /order 6 - katana
           return 1;
}

else if(strcmp(x_order, "1", true) == 0)

{

GivePlayerWeapon(playerid, 24, 999); // ii da deagle-ul. deci asa trebuia sa arate..

GivePlayerMoney(playerid, -200);

}

else if(strcmp(x_order, "2", true) == 0)

{

GivePlayerWeapon(playerid, id la shoutgun, gloante);

GivePlayerMoney(playerid, -200);

}

else if(strcmp(x_order, "3", true) == 0)

{

GivePlayerWeapon(playerid, id la m4, gloante);

GivePlayerMoney(playierd, -200);

}

 

 

 

 

 

Toate comenzile "/order" arata asa, doar ca este modificat id-ul arme si pretul.

Edited by Zone.Capone
  • Upvote 5
Link to comment
Share on other sites

Ok, nu merge. Nu asa este comanda, procesorul zcmd nu mai citeste comanda dupa spatiu. Si nici strcmp.

Adica, acum comanda o sa ia doar /order. Nu /order 1. Normal ar trebuii sa arate ceva de genu:

 

if(strcmp(cmd, "/order", true) == 0)

{

new x_order[256];

x_order= strtok(cmdtext, idx);

if(!strlen(x_order))
{

           SendUsage(playerid,"/order [1-6]");
           SendClientMessage(playerid, COLOR_WHITE, "/order 1 - deagle, /order 2 - shoutgun, /order 3 m4, /order 4 - mp5, /order 5 - ak47, /order 6 - katana
           return 1;
}

else if(strcmp(x_order, "1", true) == 0)

{

GivePlayerWeapon(playerid, 24, 999); // ii da deagle-ul. deci asa trebuia sa arate..

GivePlayerMoney(playerid, -200);

}

else if(strcmp(x_order, "2", true) == 0)

{

GivePlayerWeapon(playerid, id la shoutgun, gloante);

GivePlayerMoney(playerid, -200);

}

else if(strcmp(x_order, "3", true) == 0)

{

GivePlayerWeapon(playerid, id la m4, gloante);

GivePlayerMoney(playierd, -200);

}

... si asa mai departe.

 

#Dai edit, si fa cum ti-am zis mai sus. Bafta.

 

# Ai +1 de incurajare.

 

@

Link to comment
Share on other sites

@   Este imposibil sa mearga asa, deoarece procesorul de comanda zcmd nu executa si ce este dupa spatiu. de exemplu

 

cmd:da nu(playerid, params[])

{

...

return 1;

}

 

Citeste doar "da" adica doar comanda /da. Sau s-ar putea sa iti dea o eroare daca o faci asa. In fine, sper ca te-am ajutat.

 

# Mai bine faci tutoriale pe strcmp, deoarece cei incepatori nu cred ca este bine sa incerce direct cu zcmd. Bafta

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 1 month later...

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.

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. 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.