SA-MP Forums Archive
Adding to team via cmd - Dini - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Adding to team via cmd - Dini (/showthread.php?tid=244417)



Adding to team via cmd - Dini - DJGama101 - 27.03.2011

Hello. I wanted to add to team by cmd - but i don't know how to do it. I have 5 teams. And i want to have cmd /dodaj [playerid] [team]

Can anyone help me ?

My Settings
PHP код:
dini_IntSet(file"Team",PlayerInfo[playerid][Team]);
new 
name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playeridnamesizeof(name));
format(filesizeof(file), SERVER_USER_FILEname); 



Re: Adding to team via cmd - Dini - HyperZ - 27.03.2011

< Removed >


Re: Adding to team via cmd - Dini - ricardo178 - 27.03.2011

pawn Код:
COMMAND:setteam(playerid, params[])
{
    new id;
    new Team1;
    if(IsPlayerConnected(id))
    {
        if(PlayerInfo[playerid][AdminLevel] >= 106)
        {
            if(!sscanf(params, "ui", id, eam1))
            {
                if((Team1 >= 1 && Team1 <= 5) || Team1 == 0)
                {
                    new string[64];
                    new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    GetPlayerName(id, PlayerName, sizeof(PlayerName));
                    format(string, sizeof(string), "%s Has Make You Member Of Team %d .", name, Job1);
                    SendClientMessage(id, 0xD8D8D8FF, string);
                    format(string, sizeof(string), "You Gave %d Team Member %s .", Job1, PlayerName);
                    SendClientMessage(playerid, 0xD8D8D8FF, string);
                    PlayerInfo[id][Team] = Team1;
                    return 1;
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "Avaliable Levels: 1, 2, 3, 4, 5,");
            }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /settean [PlayerId/PartOfName] [Team]");
        }
        else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not allowed to use this command.");
    }
    else return SendClientMessage(playerid, 0xD8D8D8FF, "Player Is Not Connected");
}



Re: Adding to team via cmd - Dini - DJGama101 - 27.03.2011

ricardo178 - thanks but

D:\***\****\_F1\server_samp\gamemodes\formula1_02. pwn(1164) : error 017: undefined symbol "setteam"

Line

PHP код:
COMMAND:setteam(playeridparams[]) 



Re: Adding to team via cmd - Dini - Markx - 27.03.2011

put it on button of your script


Re: Adding to team via cmd - Dini - HyperZ - 27.03.2011

This code is better btw.
pawn Код:
COMMAND:setteam(playerid, params[])
{
    new id, pTeam, string[64], name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
    if(PlayerInfo[playerid][AdminLevel] >= 106)
    {
        if(sscanf(params, "ud", id, pTeam)) return SendClientMessage(playerid, -1, "USAGE: /setteam [PlayerId/PartOfName] [Team]");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player Not Found");
        if(pTeam > 5) return SendClientMessage(playerid, -1,"ERROR: Invalid Team, Avaliable Teams: 1, 2, 3, 4, 5");
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(id, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "%s Has Make You Member Of Team %d .", name, pTeam);
        SendClientMessage(id, -1, string);
        format(string, sizeof(string), "You Gave %d Team Member %s .", pTeam, PlayerName);
        SendClientMessage(playerid, -1, string);
        PlayerInfo[id][Team] = pTeam;
    }
    else return SendClientMessage(playerid, -1, "You are not allowed to use this command.");
    return 1;
}



Re: Adding to team via cmd - Dini - DJGama101 - 27.03.2011

Now i get this warning

D:\_***\***\_F1\server_samp\gamemodes\formula1_02. pwn(1581) : warning 203: symbol is never used: "setteam"

And command /setteam doesn't work on server :/


Re: Adding to team via cmd - Dini - ricardo178 - 27.03.2011

Just change setteam to your command!
By the way, to use this cmd you need to have included on top of your script and have sscanf plugin!

pawn Код:
#include <zcmd>
#include <sscanf2>



Re: Adding to team via cmd - Dini - HyperZ - 27.03.2011

Quote:
Originally Posted by DJGama101
Посмотреть сообщение
Now i get this warning

D:\_***\***\_F1\server_samp\gamemodes\formula1_02. pwn(1581) : warning 203: symbol is never used: "setteam"

And command /setteam doesn't work on server :/
You need zcmd and sscanf2.


Re: Adding to team via cmd - Dini - DJGama101 - 27.03.2011

Ok, now it works but it set Team to 0 not my value that i had entered :/