Jump to content
  • 0

Meniu dar nu stiu cum sa creez comanda:(


[RSD]TheBoss

Question

Am creat un Meniu pentru arme

Arme = CreateMenu("WeaponMenu", 1, 50.0, 180.0, 200.0, 200.0);

AddMenuItem(Arme, 0, "ViataArmura");

AddMenuItem(Arme, 0, "Ak47");

AddMenuItem(Arme, 0, "M4");

AddMenuItem(Arme, 0, "DesertDeagle");

public OnPlayerSelectedMenuRow(playerid, row)

{

    new Menu:current;

    current = GetPlayerMenu(playerid);

    if(current == Arme)

    {

        switch(row)

        {

            case 0:{

                SetPlayerHealth(playerid,100);

SetPlayerArmour(playerid,100);

GetPlayerMoney(playerid,-3000);

SendClientMessage(playerid,COLOR_RED,"Ai cumparat Viata si armura pentru 3000$ ");

            }

            case 1:{

GivePlayerWeapn(playerid,30,999);

GetPlayerMoney(playerid,-4500);

SendClientMessage(playerid,COLOR_RED,"Ai cumparat ak47 pentru 4500$ ");

            }

            case 2:{

GivePlayerWeapon(playerid,31,999);

GetPlayerMoney(playerid,-7960);

SendClientMessage(playerid,"Ai cumparat m4 pentru 7960$ ");

            }

            case 3:{

GivePlayerWeapn(playerid,24,999);

GetPlayerMoney(playerid,-4500);

SendClientMessage(playerid,COLOR_RED,"Ai cumparat deagle pentru 4500$ ");

            }

        }

    }

    return 1;

}

//You will have to sort the indentation out yourself

Problema e ca nu stiu sa fak comanda:'(

Si va rog lasati reply la ce am gresit

Ca vreau sa bag meiu la sv meu:)

New GameMode In Development!-Romania Team Gang War-100%!...Datimi doua Motive afrimative de ce sa-l postez si-l postez...

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Vezi daca merge ... ca nam probat ||

                                                      V

new Menu:Arme;
public OnFilterScriptInit()
{
	Arme = CreateMenu("WeaponMenu", 1, 50.0, 180.0, 200.0, 200.0);
	AddMenuItem(Arme, 0, "ViataArmura");
	AddMenuItem(Arme, 0, "Ak47");
	AddMenuItem(Arme, 0, "M4");
	AddMenuItem(Arme, 0, "DesertDeagle");
	return 1;
}
public OnFilterScriptExit()
{
	DestroyMenu(Arme);
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/arme", true) == 0)
	{
		ShowMenuForPlayer(Arme, playerid);
	}
	return 0;
}
public OnPlayerExitedMenu(playerid)
{
	new Menu:Current = GetPlayerMenu(playerid);
	HideMenuForPlayer(Current, playerid);
	return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
	new Menu:Current = GetPlayerMenu(playerid);
	if(Current == Arme)
	{
		switch(row)
		{
		    case 0:
	         if(GetPlayerMoney(playerid) >= 3000)
		        {
		            SetPlayerHealth(playerid,100);
					SetPlayerArmour(playerid,100);
					GivePlayerMoney(playerid,-3000);
					SendClientMessage(playerid,COLOR_RED,"Ai cumparat Viata si armura pentru 3000$ ");

				}
				else
				{
				    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 3000$");
				    ShowMenuForPlayer(Arme, playerid);
				}
			case 1:
	         if(GetPlayerMoney(playerid) >= 4500)
		        {
		            GivePlayerWeapon(playerid,30,999);
					GivePlayerMoney(playerid,-4500);
					SendClientMessage(playerid,COLOR_RED,"Ai cumparat ak47 pentru 4500$ ");
				}
				else
				{
				    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 4500$");
				    ShowMenuForPlayer(Arme, playerid);
				}
			case 2:
	         if(GetPlayerMoney(playerid) >= 7960)
		        {
		            GivePlayerWeapon(playerid,31,999);
					GivePlayerMoney(playerid,-7960);
					SendClientMessage(playerid,COLOR_RED,"Ai cumparat m4 pentru 7960$ ");
				}
				else
				{
				    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 7960$");
				    ShowMenuForPlayer(Arme, playerid);
				}
			case 3:
	         if(GetPlayerMoney(playerid) >= 4500)
		        {
					GivePlayerWeapon(playerid,24,999);
					GivePlayerMoney(playerid,-4500);
					SendClientMessage(playerid,COLOR_RED,"Ai cumparat deagle pentru 4500$ ");
				}
				else
				{
				    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 4500$");
				    ShowMenuForPlayer(Arme, playerid);
				}
		}
	}
	return 0;
}

i0418xcttya707ofg.jpg

Link to comment
Share on other sites

C:\Documents and Settings\Owner\Desktop\Server\filterscripts\WeaponMenu.pwn(93) : error 030: compound statement not closed at the end of file (started at line 47)

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

1 Error.

Eror :(( Ce sa fak?

New GameMode In Development!-Romania Team Gang War-100%!...Datimi doua Motive afrimative de ce sa-l postez si-l postez...

Link to comment
Share on other sites

da?

Uite scriptu:)

  #include <a_samp>

#include <core>

#include <float>

#include <string>

#include <file>

6#include <time>      (

#include <datagram>

#include <a_players>

#include <a_vehicles>

#include <a_objects>

#include <a_sampdb>

new Menu:Arme;

public OnFilterScriptInit()

{

Arme = CreateMenu("WeaponMenu", 1, 50.0, 180.0, 200.0, 200.0);

AddMenuItem(Arme, 0, "ViataArmura");

AddMenuItem(Arme, 0, "Ak47");

AddMenuItem(Arme, 0, "M4");

AddMenuItem(Arme, 0, "DesertDeagle");

return 1;

}

public OnFilterScriptExit()

{

DestroyMenu(Arme);

return 1;

}

public OnPlayerCommandText(playerid, cmdtext[])

{

if(strcmp(cmdtext, "/arme", true) == 0)

{

ShowMenuForPlayer(Arme, playerid);

}

return 0;

}

public OnPlayerExitedMenu(playerid)

{

new Menu:Current = GetPlayerMenu(playerid);

HideMenuForPlayer(Current, playerid);

return 1;

}

public OnPlayerSelectedMenuRow(playerid, row)

{

new Menu:Current = GetPlayerMenu(playerid);

if(Current == Arme)

{

switch(row)

{

    case 0:

        if(GetPlayerMoney(playerid) >= 3000)

        {

            SetPlayerHealth(playerid,100);

SetPlayerArmour(playerid,100);

GivePlayerMoney(playerid,-3000);

SendClientMessage(playerid,0xEC2700FF,"Ai cumparat Viata si armura pentru 3000$ ");

}

else

{

    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 3000$");

    ShowMenuForPlayer(Arme, playerid);

}

case 1:

        if(GetPlayerMoney(playerid) >= 4500)

        {

            GivePlayerWeapon(playerid,30,999);

GivePlayerMoney(playerid,-4500);

SendClientMessage(playerid,0xEC2700FF,"Ai cumparat ak47 pentru 4500$ ");

}

else

{

    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 4500$");

    ShowMenuForPlayer(Arme, playerid);

}

case 2:

        if(GetPlayerMoney(playerid) >= 7960)

        {

            GivePlayerWeapon(playerid,31,999);

GivePlayerMoney(playerid,-7960);

SendClientMessage(playerid,0xEC2700FF,"Ai cumparat m4 pentru 7960$ ");

}

else

{

    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 7960$");

    ShowMenuForPlayer(Arme, playerid);

}

case 3:

        if(GetPlayerMoney(playerid) >= 4500)

        {

GivePlayerWeapon(playerid,24,999);

GivePlayerMoney(playerid,-4500);

SendClientMessage(playerid,0xEC2700FF,"Ai cumparat deagle pentru 4500$ ");

}

else

{

    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 4500$");

    ShowMenuForPlayer(Arme, playerid);

}

}

}

return 0;

Nu lipseste nimik la linia 93:

New GameMode In Development!-Romania Team Gang War-100%!...Datimi doua Motive afrimative de ce sa-l postez si-l postez...

Link to comment
Share on other sites

adauga } sub ultimul return 0;

ti l-am pus eu xD :

#include <a_samp>
#include <core>
#include <float>
#include <string>
#include <file>
#include <time>
#include <datagram>
#include <a_players>
#include <a_vehicles>
#include <a_objects>
#include <a_sampdb>



new Menu:Arme;

public OnFilterScriptInit()
{
	Arme = CreateMenu("WeaponMenu", 1, 50.0, 180.0, 200.0, 200.0);
	AddMenuItem(Arme, 0, "ViataArmura");
	AddMenuItem(Arme, 0, "Ak47");
	AddMenuItem(Arme, 0, "M4");
	AddMenuItem(Arme, 0, "DesertDeagle");
	return 1;
}
public OnFilterScriptExit()
{
	DestroyMenu(Arme);
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/arme", true) == 0)
	{
		ShowMenuForPlayer(Arme, playerid);
	}
	return 0;
}
public OnPlayerExitedMenu(playerid)
{
	new Menu:Current = GetPlayerMenu(playerid);
	HideMenuForPlayer(Current, playerid);
	return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
	new Menu:Current = GetPlayerMenu(playerid);
	if(Current == Arme)
	{
		switch(row)
		{
		    case 0:
	         if(GetPlayerMoney(playerid) >= 3000)
		        {
		            SetPlayerHealth(playerid,100);
					SetPlayerArmour(playerid,100);
					GivePlayerMoney(playerid,-3000);
					SendClientMessage(playerid,0xEC2700FF,"Ai cumparat Viata si armura pentru 3000$ ");

				}
				else
				{
				    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 3000$");
				    ShowMenuForPlayer(Arme, playerid);
				}
			case 1:
	         if(GetPlayerMoney(playerid) >= 4500)
		        {
		            GivePlayerWeapon(playerid,30,999);
					GivePlayerMoney(playerid,-4500);
					SendClientMessage(playerid,0xEC2700FF,"Ai cumparat ak47 pentru 4500$ ");
				}
				else
				{
				    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 4500$");
				    ShowMenuForPlayer(Arme, playerid);
				}
			case 2:
	         if(GetPlayerMoney(playerid) >= 7960)
		        {
		            GivePlayerWeapon(playerid,31,999);
					GivePlayerMoney(playerid,-7960);
					SendClientMessage(playerid,0xEC2700FF,"Ai cumparat m4 pentru 7960$ ");
				}
				else
				{
				    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 7960$");
				    ShowMenuForPlayer(Arme, playerid);
				}
			case 3:
	         if(GetPlayerMoney(playerid) >= 4500)
		        {
					GivePlayerWeapon(playerid,24,999);
					GivePlayerMoney(playerid,-4500);
					SendClientMessage(playerid,0xEC2700FF,"Ai cumparat deagle pentru 4500$ ");
				}
				else
				{
				    SendClientMessage(playerid,0xEC2700FF,"Not enough money! 4500$");
				    ShowMenuForPlayer(Arme, playerid);
				}
		}
	}
	return 0;
}

acolada a fost deschisa la linia 47 si trebuia inchisa la final dupa return 0; asta era problema :)

Link to comment
Share on other sites

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

    • By TheGodfather
      Salut, vreau sa fac o comanda /lastchat cu care sa pot sa vad ultimele x mesaje ale unui jucator. Am incercat asa dar nu imi afiseaza nimic.
      YCMD:lastchat(playerid, params[], help) {
          if(aspam[playerid] > 0) return SCMEx(playerid, COLOR_LIGHTRED, "[Command Anti-Spam] {FFFFFF}Wait %d seconds.", aspam[playerid]);
          if(PlayerInfo[playerid][pAdmin] < 😎 return SCM(playerid,COLOR_WHITE,AdminOnly);
          new giveplayerid[25],id,cont,name[30];
          if(sscanf(params, "s[25]d", giveplayerid, id)) return SCM(playerid,COLOR_GREY, "Syntax: {FFFFFF}/lastchat <name> <number of messages>");
          cont = MySQLCheckAccount(giveplayerid);
          if(cont == 0) return SCM(playerid,COLOR_ERROR,"Error:{FFFFFF} This account was not found in the database!");
          GetPlayerName(playerid, name, sizeof name);
          //
          new szQuery[256], string[180], MemberString[1024], szResult[180], text[180],TitleString[180];
          format(szQuery, sizeof(szQuery), "SELECT * FROM `logs` WHERE `Name`='%s' ORDER BY `ID` DESC LIMIT %d", GetName(playerid), id);
          new Cache: result = mysql_query(SQL, szQuery);
          for(new i, j = cache_num_rows(); i != j; ++i)
          {
              cache_get_field_content(i, "player", szResult); format(name, 256, szResult);
              cache_get_field_content(i, "Text", szResult);  format(text, 256, szResult);
              format(string, sizeof(string), "%s", text);strcat(MemberString, string, sizeof(MemberString));
          }
          cache_delete(result);
          format(TitleString, sizeof(TitleString), "Last %d messages from player %s.", id, name);
          ShowPlayerDialog(playerid, DIALOG_LASTCHAT, DIALOG_STYLE_TABLIST_HEADERS, TitleString, MemberString, "Ok", "Exit");
          //
          return 1;
      }
      case DIALOG_LASTCHAT: {
                  if(!response) return true;
              }
    • By TheGodfather
      Salut, am aceasta comanda /servername dar nu trimite mesajul acela tuturor playerilor, numele la server se schimba corect.
      if(strcmp(cmdtext, "/servername", true) == 0)
          {
              if(PlayerInfo[playerid][pAdmin] < 😎 return SCM(playerid, COLOR_WHITE, AdminOnly);
              new newstring[512], idx, tmp[512];
              tmp = strtok(cmdtext, idx);
              if(strlen(cmdtext[12]) < 1) return SCM(playerid, COLOR_GREY,"Syntax: /servername <nume server>");
              format(tmp, sizeof(tmp), "hostname %s", cmdtext[12]);
              SendRconCommand(tmp);
              format(newstring, sizeof(newstring), "[SERVER] {FFFFFF}Fondator {DA0000}%s {FFFFFF}a schimbat numele server-ului in {FFFFFF}'%s'.", GetName(playerid), cmdtext[12]);
              SCMTA(COLOR_LIGHTBLUE, newstring);
              return 1;
          }
    • By xLinix96
      Salut, asta este prima mea postare pe aceasta comunitate, astazi vreau sa va arat cum sa creati o comanda /flymode, stiu ca este o comanda foarte simpla, dar sunt unii incepatori care nu stiu sa o faca.
       
      Pentru inceput aveti nevoie de un include.
      #include <fly>
      Il gasiti aici: http://www.solidfiles.com/d/289d6c8fdf/
       
       
      Acum vom face comanda:
      CMD:fly(playerid, params[])
      {
          if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa te comenctezi."); // aici verificam daca esti conectat
          if(IsPlayerConnected(playerid)) 
          {
              if(PlayerInfo[playerid][pAdmin] >= 1) // aici punem nivelul de admin necesar pentru a folosii comanda.
              {
                  new sendername[30],string[256];
                  if(flymode[playerid] == 0)
                  {
                      GetPlayerName(playerid, sendername, sizeof(sendername)); // aici obtinem numele adminuui.
                      togfind[playerid] = 0;
                      flymode[playerid] = 1;
                      format(string,sizeof(string),"{DFF230}%s este acum in modul fly-mode.", sendername); 
                      ABroadCast(COLOR_ORANGE,string,1);
                      InitFly(playerid);
                      StartFly(playerid);
                      SetPlayerHealthEx(playerid, 10000000); // aici setam hp-ul.
                  }
                  else
                  {
                      GetPlayerName(playerid, sendername, sizeof(sendername)); // iar de aici oprim fly-ul.
                      togfind[playerid] = 1;
                      flymode[playerid] = 0;
                      format(string,sizeof(string),"{F89AD6}Ai oprit fly-mode-ul", sendername);
                      SCM(playerid, COLOR_GREEN, string);
                      StopFly(playerid);
                      SetPlayerHealthEx(playerid, 100); // 
                  }
              }
              else return SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
          }
          return 1;
      }
       
      Sper ca v-am ajutat, nu este cine site ce sistem.
       
       
    • By Lwka
      Salutare! Cum pot face o comanda CMD sa fie pe YCMD ?
      CMD:admins(playerid, params[]) { if(GPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You need to login first."); if(IsPlayerConnected(playerid)) { new string[200],sendername[30]; SendClientMessage(playerid, COLOR_WHITE, "{408080}-----Admins Online------------------------"); foreach(Player,i) { if(IsPlayerConnected(i)) { if(PlayerInfo[pAdmin] == 1) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{EEEEEE} (%d) %s - Moderator", i, sendername); SendClientMessage(playerid, -1, string); } if(PlayerInfo[pAdmin] == 2) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{EEEEEE} (%d) %s - Junior Admin", i, sendername); SendClientMessage(playerid, -1, string); } if(PlayerInfo[pAdmin] == 3) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{EEEEEE} (%d) %s - General Admin", i, sendername); SendClientMessage(playerid, -1, string); } if(PlayerInfo[pAdmin] == 4) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{EEEEEE} (%d) %s - Senior Admin", i, sendername); SendClientMessage(playerid, -1, string); } if(PlayerInfo[pAdmin] == 5) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{EEEEEE} (%d) %s - Supervizor", i, sendername); SendClientMessage(playerid, -1, string); } if(PlayerInfo[pAdmin] == 6) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, 256, "{EEEEEE} (%d) %s - Detinator", i, sendername); SendClientMessage(playerid, -1, string); } } } SendClientMessage(playerid, COLOR_WHITE, "{408080}--------------------------------------------"); SendClientMessage(playerid, COLOR_WHITE, "Daca ai vreo problema, poti folosi /report. Pentru intrebari legate de joc poti folosi /n."); SendClientMessage(playerid, COLOR_WHITE, "{408080}--------------------------------------------"); } return 1; }  
    • By xVincenzo
      salut, am si eu nevoie de acest doua comenzi va rog!
  • 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.