Resurse CS,Jocuri Online Si Multe Altele


Share | 
 

 [SA:MP] Cum adugam Helper

View previous topic View next topic Go down 
AuthorMessage
xPlode
Admin Forum
Admin Forum


Posts : 265
Join date : 26/08/2011
Age : 19

PostSubject: [SA:MP] Cum adugam Helper    Sun Sep 04, 2011 6:15 am

In acest tutorial invatati cum sa adugati Helperi (ajutoare la Admini)

Cutam:
Code:
pAdmin,

si mai jos adaugam:
Code:
pHelper,

Cautam:
Code:
 PlayerInfo[playerid][pAdmin] = 0;

si mai jos adaugam:
Code:
PlayerInfo[playerid][pHelper] = 0;

Acuma daca vreti sa va apara la /stats ce nivel de Helper aveti faceti in felul urmator:
Cautam:
Code:
public ShowStats(playerid,targetid)

si mai jos adaugam:
Code:
new helperl = PlayerInfo[targetid][pHelper];

iar intr-o linie de mai jos asemanatoare cu acesta:
Code:
format(coordsstring, sizeof(coordsstring), "Warns:[%d] AdminLevel:[%d]  Crack:[%d]",warns,adminl,crack);

adaugam:
Code:
HelperLevel: [%d]

iar la sfarsitul liniei pana in ) adaugam:
Code:
,helperl

deci va trebui sa avem in urmatorul fel:
Code:
format(coordsstring, sizeof(coordsstring), "Warns:[%d] AdminLevel:[%d] HelperLevel: [%d] Crack:[%d]",warns,adminl,helperl,crack);

Mergem la:
Code:
public OnPlayerRegister(playerid, password[])

si dupa:
Code:
format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);

adaugam:
Code:
format(var, 32, "HelperLevel=%d\n",PlayerInfo[playerid][pHelper]);fwrite(hFile, var);

Mergem la:
Code:
public OnPlayerUpdate(playerid)

si dupa:
Code:
format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);

adaugam:
Code:
format(var, 32, "HelperLevel=%d\n",PlayerInfo[playerid][pHelper]);fwrite(hFile, var);

Mergem la:
Code:
public OnPlayerLogin(playerid,password[])

si dupa:
Code:
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }

adaugam:
Code:
if( strcmp( key , "HelperLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHelper] = strval( val ); }

La sfarsitul modului adauga:
Code:
public HBroadCast(color,const string[])

                  for(new i = 0; i < MAX_PLAYERS; i++)
{
                if(IsPlayerConnected(i))
{
                  if (PlayerInfo[i][pHelper] != 0)
{
                  SCM(i, color, string);
                  printf("%s", string);
}

Adaugam urmatoarele comenzi la public OnPlayerCommandText:
Code:
if(strcmp(cmd, "/goto", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {//www.csresurse.4rumer.com
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /goto [playerid/PartOfName]");
                return 1;
            }//www.csresurse.4rumer.com
            new Float:plocx,Float:plocy,Float:plocz;
            new plo;
            plo = ReturnUser(tmp);
            if (IsPlayerConnected(plo))
            {//www.csresurse.4rumer.com
                if(plo != INVALID_PLAYER_ID)
                {
                    if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)//www.csresurse.4rumer.com
                    {
                        if(Spectate[playerid] != 255)
                        {
                            Spectate[playerid] = 256;
                        }
                        GetPlayerPos(plo, plocx, plocy, plocz);
                        if(PlayerInfo[plo][pInt] > 0)
                        {//www.csresurse.4rumer.com
                            SetPlayerInterior(playerid,PlayerInfo[plo][pInt]);
                            PlayerInfo[playerid][pInt] = PlayerInfo[plo][pInt];
                            PlayerInfo[playerid][pLocal] = PlayerInfo[plo][pLocal];
                        }//www.csresurse.4rumer.com
                        if(PlayerInfo[playerid][pInt] == 0)
                        {
                            SetPlayerInterior(playerid,0);
                        }
                        if(plocz > 530.0 && PlayerInfo[plo][pInt] == 0) //the highest land point in sa = 526.8
                        {
                            SetPlayerInterior(playerid,1);
                            PlayerInfo[playerid][pInt] = 1;
                        }//www.csresurse.4rumer.com
                        if (GetPlayerState(playerid) == 2)
                        {
                            new tmpcar = GetPlayerVehicleID(playerid);
                            SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                            TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
                        }//www.csresurse.4rumer.com
                        else
                        {
                            SetPlayerPos(playerid,plocx,plocy+2, plocz);
                        }
                        SendClientMessage(playerid, COLOR_GRAD1, "  You have been teleported");
                    }
                    else
                    {//www.csresurse.4rumer.com
                        SendClientMessage(playerid, COLOR_GRAD1, "  you are not authorized to use that command!");
                    }
                }
            }
            else//www.csresurse.4rumer.com
            {
                format(string, sizeof(string), " That player is not connected.", plo);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }//www.csresurse.4rumer.com
        }
        return 1;
    }

Definim la forward:
Code:
forward SendHelperMessage(color, string[]);

Si asta a fost tutorialul!!!!
Back to top Go down
View user profile http://csresurse.4rumer.ro
 
[SA:MP] Cum adugam Helper
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Resurse CS,Jocuri Online Si Multe Altele :: Alte Jocuri :: San Andreas / SAMP :: TUTORIALE San Andreas / SAMP-
Jump to: