SA-MP Forums Archive
Group With Textdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Group With Textdraw (/showthread.php?tid=636411)



Group With Textdraw - SteSte - 26.06.2017

How you all doing?
I need help in making my group system for my gamemode, explaination below.


Any player can decide to make a squad by just using the /invite [playerid] command, when any player /invite and the other player accepts the invitation then both of them are now a squad, only the squad leader can invite/uninvite but the squad cannot be disbanded instead players can just /leavesquad. If the squadleader leaves, the squad will still be together but the player who leaves (the leader) is not in it anymore and the leadership would go to the first person who was invited but if everyone else leaves then the squad is disbanded.

When a squad is formed there will be a textdraw that appears on the squad members screen listing all the members and their ID's when a player leaves, there textdraw would disappear such as this Group With Textdraw notice that the group members are listed on a textdraw on the right, and thats kinda what I'm making but I'm stuck.


I can explain further but I prefer to get help first, I started but I can't finish and I would appreciate if someone can PM me their skype so they can help me, with it (I would learn easier)

Feel free to comment any helps please but just know that I dont want anybody to make it for me, I want to make it myself I just need someone to guide me, and help me make it correctly. If you want me to post what I've already started with, feel free to ask.


Re: Group With Textdraw - SteSte - 27.06.2017

Can anybody explain what I did wrong please.

PHP код:
#define MAX_MEMBERS 8
new
InSquad 0//Player is not in a squad, 1 means player is in a squad
SquadMembers[MAX_PLAYERS]; 
PHP код:
public OnPlayerDisconnect(playeridreason)
{
    
InSquad 0;
    return 
1;

PHP код:
CMD:squadinvite(playeridparams[])
{
    new 
targetidstr[120],
    
name[MAX_PLAYER_NAME],
    
tname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    
GetPlayerName(targetidtnamesizeof(name));
    if(
sscanf(params"d"targetid))
    {
        
SendClientMessage(playeridCol_Grey"USAGE: /squadinvite [playerid]");
    }
    else
    {
        if(
IsPlayerConnected(targetid))
        {
            if(
InSquad(targetid) == 0)
            {
                new 
squadmembers SquadMembers[playerid]
                if(
squadmembers != MAX_MEMBERS)
                {
                    
format(strsizeof(str), "You have successfully sent a squad invitation to %s."tname);
                    
ShowPlayerDialog(targetid99DIALOG_STYLE_MSGBOX"Squad Invitation""%s has invited you to their squad""Accept""Deny");
                    
SendClientMessage(playeridCol_Greenstr);
                    
InSquad(targetid) = 1;
                }
                else
                {
                    
SendClientMessage(playeridCol_Red"ERROR: Maximum members reached.");
                }
            }
            else
            {
                
SendClientMessage(playeridCol_Red"ERROR: Player is already in a squad.");
            }
        }
        else
        {
            
SendClientMessage(playeridCol_Red"ERROR: INVALID ID");
        }
    }
    return 
1;

Код:
E:\SA-MP Server Scripts\[S]uper\gamemodes\[S]uper2.pwn(398) : error 012: invalid function call, not a valid address
E:\SA-MP Server Scripts\[S]uper\gamemodes\[S]uper2.pwn(398) : warning 215: expression has no effect
E:\SA-MP Server Scripts\[S]uper\gamemodes\[S]uper2.pwn(398) : error 001: expected token: ";", but found ")"
E:\SA-MP Server Scripts\[S]uper\gamemodes\[S]uper2.pwn(398) : error 029: invalid expression, assumed zero
E:\SA-MP Server Scripts\[S]uper\gamemodes\[S]uper2.pwn(398) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Quote:

if(InSquad(targetid) == 0)

For line 398, this is it above, its suppose to check if the target is already in a squad.


Re: Group With Textdraw - HoussemGaming - 27.06.2017

Change (targetid) by [targetid]


Re: Group With Textdraw - SteSte - 27.06.2017

Quote:
Originally Posted by HoussemGaming
Посмотреть сообщение
Change (targetid) by [targetid]
Thank you.