[Help] Command Invite Problem
#1

How to install when slot 1 is busy that he could not invite him into the organization in this slot 1

Код:
CMD:invite(playerid,params[])
{
	new id,slot;
	if(sscanf(params, "ui", id, slot)) return SCM(playerid, GRAD2, "/invite (playerid) (slot)");
	if(PlayerInfo[playerid][pLeader] < 1) return SCM(playerid, GRAD2, "Nisi lider.");
	if(PlayerInfo[id][pLeader] > 0) return SCM(playerid, GRAD2, "Ne mozete ubaciti u organizaciju lidera neke org.");
	if(PlayerInfo[id][pMember] > 0) return SCM(playerid, GRAD2, "Taj gradjanin je vec u nekoj organizaciji!");
	if(WantedLevel[id] > 0) return SCM(playerid, GRAD2, "Taj gradjanin je trazen.");
	if(PlayerInfo[id][pAdmin] > 0) return SCM(playerid, GRAD2, "Taj gradjanin je Admin, ne mozes to.");
	if(PlayerInfo[id][pKazna] > 0) return SCM(playerid, GRAD2,"On/a je kaznjen/a, ne mozete ga/je invite-ovati!");
	if(slot < 1 || slot > 15) return SCM(playerid, GRAD2, "Slot ne moze biti manji od 1 ili veci od 15!");
	if(PlayerInfo[id][pHelper] > 0) return SCM(playerid, GRAD2, "Taj gradjanin je helper, ne mozes to.");
	if(playerid == id) return SCM(playerid, GRAD2, "Ne mozete sami sebe !");
	//if(aaaorg[playerid] != 9999) return SCM(playerid, GRAD2, "Nekome si vec ponudio invite!");
	if(PlayerInfo[id][pLevel] < 3)
	{
		SendClientMessage(playerid, COLOR_GREY, "[GRESKA] Igrac mora biti minimum level 3! ");
		return 1;
	}
	else if(PlayerInfo[playerid][pLeader] == 18 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2)
	{
		if(PlayerInfo[id][pDiploma] == 0)
		{
			SCM(playerid,COLOR_PURPLE,"Igrac nema diplomu, tako da ne moze u organizaciju !");
			return 1;
		}
	}
	for(new i=1; i<MAX_PLAYERS; i++)
	{
	if(PlayerInfo[i][pMember] == PlayerInfo[playerid][pLeader])
	{
	if(PlayerInfo[i][pMSlot] == slot)
	{
	SendClientMessage(playerid, -1,"Ovaj slot je zauzet od drugog igraca");
	return 1;
	}
	}
	}
	poslot[id] = slot;
	prihvatiorgli[id] = playerid;
	prihvatiorg[id] = PlayerInfo[playerid][pLeader];
	aaaorg[playerid] = id;
	SCMF(playerid, -1, ""COL_EXYU"EX:YU: {FFFFFF}Poslali ste zahtev gradjaninu %s da se prikljuci vasoj organizaciji.",GetName(id));
	new org[128];
	if(PlayerInfo[id][pLeader] == 1) { org = "Policija"; }
	else if(PlayerInfo[id][pLeader] == 2) { org = "Zandarmerija"; }
	else if(PlayerInfo[id][pLeader] == 3) { org = "Vojska"; }// NOVA ORG
	else if(PlayerInfo[id][pLeader] == 4) { org = "Hitna Pomoc"; }
	else if(PlayerInfo[id][pLeader] == 5) { org = "Ruska mafia"; }
	else if(PlayerInfo[id][pLeader] == 6) { org = "LCN"; }
	else if(PlayerInfo[id][pLeader] == 7) { org = "Vlada"; }
	else if(PlayerInfo[id][pLeader] == 8) { org = "Zemunski Klan"; }
	else if(PlayerInfo[id][pLeader] == 9) { org = "Novinari"; }
	else if(PlayerInfo[id][pLeader] == 10) { org = "Taxi"; }
	else if(PlayerInfo[id][pLeader] == 11) { org = "Yakuza"; }
	else if(PlayerInfo[id][pLeader] == 12) { org = "Parking Servis"; }
	else if(PlayerInfo[id][pLeader] == 13) { org = "Ballas Family"; }
	else if(PlayerInfo[id][pLeader] == 14) { org = "Los Surenos"; }
	else if(PlayerInfo[id][pLeader] == 15) { org = "MS-13"; }
	else if(PlayerInfo[id][pLeader] == 16) { org = "Grove Street Family"; }
	else if(PlayerInfo[id][pLeader] == 17) { org = "Hitman"; }
	else if(PlayerInfo[id][pLeader] == 18) { org = "Saobracajna Policija"; }
	else if(PlayerInfo[id][pLeader] == 19) { org = "Policijska Akademija"; }
	else if(PlayerInfo[id][pLeader] == 20) { org = "Privatna Org. 1"; }
	else if(PlayerInfo[id][pLeader] == 21) { org = "Bajkeri"; }
	else if(PlayerInfo[id][pLeader] == 22) { org = "Privatna Org. 2"; }
	new dia[2024];
	format(dia,sizeof(dia),"{00ccff}Lider %s vas je pozvao u organizaciju {ff0000}%s.\n{00ccff}Da li zelite da udjete u nju ?",GetName(playerid),PlayerInfo[id][pLeader]);
	SPD(id, D_INVITE, DSM, ""COL_EXYU"Organizacija", dia, "Da", "Ne");
	return 1;
}
Код:
switch (dialogid)
{
    case D_INVITE:
    {
        if (response)
        {
            if (!(0 <= prihvatiorgli[playerid] < sizeof PlayerInfo)) return 1; // if its value is out of bounds, run time error will occur - we don't want that so stop it here

            new str[128], File:log, _pChar_[] = {280, 163, 287, 176, 73, 101, 147, 47, 37, 262, 122, 16, 103, 114, 109, 106, 291, 302, 71, 254, 48, 254, 21};
            new ubacios[256], ubacio[256];

            PlayerInfo[playerid][pMember] = PlayerInfo[prihvatiorgli[playerid]][pLeader];
            PlayerInfo[playerid][pRank] = 1;
            PlayerInfo[playerid][pMSlot] = poslot[playerid];

            format(str,128,"FACTION: {FFFFFF}Lider %s je ubacio clana %s u organizaciju!",GetName(prihvatiorgli[playerid]),GetName(playerid));
            SendFamilyMessage(PlayerInfo[prihvatiorgli[playerid]][pLeader],0xFF0000FF,str);
            //SCMF(prihvatiorgli[playerid], -1, ""COL_EXYU"EX:YU: {FFFFFF}Ubacili ste gradjanina %s u vasu organizaciju, slot: %d!", GetName(playerid), poslot[playerid]);
            format(ubacios,sizeof(ubacios),""COL_EXYU"EX:YU: {FFFFFF}Ubacili ste gradjanina %s u vasu organizaciju, slot: %d!", GetName(playerid), poslot[playerid]);
            SCM(prihvatiorgli[playerid], -1,ubacios);
			format(ubacio,sizeof(ubacio),""COL_EXYU"EX:YU: {FFFFFF}Ubaceni ste u organizaciju ID:%d od strane lidera %s, slot: %d!", PlayerInfo[prihvatiorgli[playerid]][pLeader], GetName(prihvatiorgli[playerid]), poslot[playerid]);
			SCM(playerid,-1,ubacio);
			//SCMF(playerid, -1, ""COL_EXYU"EX:YU: {FFFFFF}Ubaceni ste u organizaciju ID:%d od strane lidera %s, slot: %d!", PlayerInfo[prihvatiorgli[playerid]][pLeader], GetName(prihvatiorgli[playerid]), poslot[playerid]);

            if (1 <= PlayerInfo[prihvatiorgli[playerid]][pLeader] <= 22) SetPlayerSkin(playerid, (PlayerInfo[playerid][pChar] = _pChar_[PlayerInfo[prihvatiorgli[playerid]][pLeader] - 1]));

            aaaorg[prihvatiorgli[playerid]] = prihvatiorgli[playerid] = 9999;
            prihvatiorg[playerid] = poslot[playerid] = 0;

            SetPlayerTeam(playerid, PlayerInfo[playerid][pMember]);

            format(str,sizeof str,"organizacije/%d/%d.txt",PlayerInfo[playerid][pMember],PlayerInfo[playerid][pMSlot]);
            log = fopen(str, io_write);

            if (log) // opened successufully, if it was not and use file functions the server will crash
            {
                 fwrite(log, GetNameEx(playerid));
                 fclose(log);
            }

            //SacuvajPodaci();
            SacuvajPodaci(playerid);
        }
        else
        {
            SCM(playerid, -1, ""COL_EXYU"EX:YU: {FFFFFF}Odbili ste poziv u organizaciju.");
            SCMF(prihvatiorgli[playerid], -1, ""COL_EXYU"EX:YU: {FFFFFF}%s je odbio poziv u organizaciju.",GetName(playerid));

            if (0 <= prihvatiorgli[playerid] < sizeof aaaorg) aaaorg[prihvatiorgli[playerid]] = 9999;
            prihvatiorgli[playerid] = 9999;
            prihvatiorg[playerid] = 0;
        }
        return 1;
    }
}
Reply
#2

Код:
new invited[MAX_PLAYERS][MAX_PICKUPS];

for(new a=15;a<155;a++){ kviestas[playerid][a]=false;}
Код:
else if (strcmp(text, "invite", true,6)==0){
		if(text[6] == 0) {	SendClientMessage(playerid, TEXTCOL_GREY, "Invite player to your house: invite [name]");	return 0;}
		new id = GetPlayeridMid(text[7]);
		if(id == INVALID_PLAYER_ID) {SendClientMessage(playerid, TEXTCOL_GREY, "Player not exist");	return 0;}
		invited[id][GetPlayerVirtualWorld(playerid)]=true;
		new zin[256],name[MAX_PLAYER_NAME];
		GetPlayerName(playerid,name,MAX_PLAYER_NAME);
		format(zin,sizeof(zin),"%s invited you to house",name);
		SendClientMessage(id,TEXTCOL_BLUE,zin);
		GetPlayerName(id,name,MAX_PLAYER_NAME);
		format(zin,sizeof(zin),"You invited %s if you want to cancel : noinvite %s",name,name);
		SendClientMessage(playerid,TEXTCOL_BLUE,zin);
		return 0;}
Reply
#3

When you invite players to work with than his father when another player in this slot that he could not invite him in this slot than the slot which is free
Reply
#4

mmm See This I thin will help you : https://sampforum.blast.hk/showthread.php?pid=1850979#pid1850979
Reply
#5

Invite doing everything nice when you just wanna throw a player in the organization to the other players in this slot may not care to one that is not busy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)