Jump to content
  • 0

am nevoie de ajutor


ToX1c

Question

1.Am o problema cu , comanda /ticket cum fac sa nu mai dea pe minus cand un cop ii da la un civil sau la oricine /ticket si acel playeri nu are bani respectivi sa nu mearga sa dea /accept ticket.

if(strcmp(cmd, "/ticket", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(gTeam[playerid] != 2)
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You are not a Cop!");
			    return 1;
			}
	        if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You are not on Duty!");
			    return 1;
			}
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
				return 1;
			}
			moneys = strval(tmp);
			if(moneys < 1 || moneys > 5) { SendClientMessage(playerid, COLOR_GREY, "   Ticket Money can't be below 1 or higher then 10 !"); return 1; }
			if(IsPlayerConnected(giveplayerid))
			{
							if(PlayerInfo[playerid][pCash] < 5)
						{
						  SendClientMessage(playerid,COLOR_LIGHTBLUE,"You can not affrod that.");
						  return 1;
						}
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        if (ProxDetectorS(8.0, playerid, giveplayerid))
					{
					    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
							return 1;
						}
						format(string, sizeof(string), "* You gave %s a Ticket costing $%d, reason: %s", giveplayer, moneys, (result));
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Officer %s has given you a Ticket costing $%d, reason: %s", sendername, moneys, (result));
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Type /accept ticket, to accept it.");
						TicketOffer[giveplayerid] = playerid;
						TicketMoney[giveplayerid] = moneys;
						return 1;
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "   That player is not near you !");
						return 1;
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !");
			    return 1;
			}
		}
		return 1;
	}

2.Tot la fel si la comanda /heal pentru medici ca la 1.sa nu poata da pe minus.

3.care poate sa ma ajute si pe mine la comanda /givemats sa pot da /accept mats ca nu reusesc sa o fac.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

1 si 2, foloseste GetPlayerMoney

if(GetPlayerMoney(playerid) <= 0) 
{
    //restul
}
else
{
    SendClientMessage(playerid, COLOR_RED, "Nu ai destui bani!");
}
3.Probleme Godfather, foloseste o noua variabila:
new Mats[MAX_PLAYERS];

Mats[matsplayer]=1; // matsplayer inlocuiesti cu chestia din comanda a jucatorului care a primit /give mats

if(strcmp(cmdtext,"/accept mats",true) == 0)
{ 
    if(Mats[matsplayer]==1)
    {
        //chestii pentru mats
    }
    else
    { 
         SendClientMessage(playerid,COLOR_RED,"Nu ti s-au oferit 'Mats');
    }
    return 1;
}

Nici nu stiu ce inseamna Mats :]], cred ca te-ai prins cum vine comanda.

Link to comment
Share on other sites

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

    • By Tefyuu
      CMD:aduty(playerid, params[])
      {
          if(IsPlayerAdmin(playerid)) 
          {
                      new type[25];
                      
      28971 :        if(sscanf(params, "s[25]", type)) return SendClientMessage(playerid, -1,"Syntax: /aduty <on/off>");
              if(strcmp(type, "off", true) == 0)
              {
                  ResetPlayerWeapons(playerid); 
      28979:                    SetPlayerArmour(playerid, 0); 
                          SetPlayerHealth(playerid, 100); 
                          SetPlayerSkin(playerid, 25); 
      28985:          SendClientMessageToAll(COLOR_RED, "((AdmBot: Unul dintre administratori este acum off duty.))"); 
              }
              else if(strcmp(type, "on", true) == 0)
              {
                          GivePlayerWeapon(playerid, 38, 9999); 
                          SetPlayerArmour(playerid, 9999999); 
                          SetPlayerHealth(playerid, 9999999); 
                          SetPlayerSkin(playerid, 217); 
      29001:            SendClientMessageToAll(COLOR_GREEN, "((AdmBot: Unul dintre administratori este acum on duty.))"); 
              }
          }
          else 
          {
              SendClientMessage(playerid, COLOR_RED, "Eroare: Nu esti un Administrator.");
          }
          return 1;
      }
       
       
       
       
      in aceasta comanda primesc erorile astea 
       
      C:\Users\tefyuu\Desktop\burned.ro\gamemodes\wa-rpg.pwn(28971) : warning 217: loose indentation
      C:\Users\tefyuu\Desktop\burned.ro\gamemodes\wa-rpg.pwn(28979) : warning 217: loose indentation
      C:\Users\tefyuu\Desktop\burned.ro\gamemodes\wa-rpg.pwn(28985) : warning 217: loose indentation
      C:\Users\tefyuu\Desktop\burned.ro\gamemodes\wa-rpg.pwn(29001) : warning 217: loose indentation
    • By VAurel
      Salut, am vrut sa fac comanda /housemenu, pentru a putea seta descrierea casei si mai multe chestii, doar ca am intampinat o problema.
      Eu am vrut sa fac prima oara intr-un dialog in care sa apara o lista de unde sa alegi ce vrei sa faci, ok am facut asta si functioneaza. Am facut dialogul de setarea descrierei casei, doar ca nu mi-se deschide dialog-ul unde trebuie sa scriu asta. Aveti o poza mai jos cu codul, multumesc pentru atentie ❤️ 
      Eu nu imi dau seama de ce am facut gresit, daca este ceva care este gresit si este iesit in evidenta, v-as ruga sa imi atrageti atentia, pentru ca oricum eu lucrez numai la ore tarzii, si sa nu mai repet aceeasi greseala  Multumes anticipat ❤️ 
       

    • By D3m0n1K
      Buna Seara, descriere problema : cand ajung la dmv si scriu exam, nu imi afiseaza astea, daca doriti pot adauga liniile care este nevoie.
       
       
    • By DeiuYT
      cand dau clanzones imi apar ca toate locatiile sunt in blueberry acres iar in gm nu vad unde as putea schimba locatia nici in baza de date
  • 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.