SA-MP Forums Archive
Leader name - 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: Leader name (/showthread.php?tid=298025)



Leader name - Qur - 18.11.2011

Hey.. I'm trying to make that if you enter to a place so the name of the leader of the faction i'll decide will be mentioned...
this is part from my /enter command:

pawn Code:
else if (PlayerToPoint(2.0, playerid,2421.4934,-1219.2512,25.5613)) //
            {
                SetPlayerInterior(playerid,2);
                SetPlayerPos(playerid,1204.809936,-11.586799,1000.921875);
                new leader = PlayerInfo[playerid][pLeader] = 1;
                new tmp2[256];
                format(tmp2, sizeof(tmp2), "~w~This place owned by:~g~ %s", leader);
                GameTextForPlayer(playerid, tmp2, 5000, 1);
            }
and ofc.. its not working cuz i'm doing something wrong..


Re: Leader name - Luis- - 18.11.2011

pawn Code:
else if (PlayerToPoint(2.0, playerid,2421.4934,-1219.2512,25.5613)) //
            {
                SetPlayerInterior(playerid,2);
                SetPlayerPos(playerid,1204.809936,-11.586799,1000.921875);
                new leader = PlayerInfo[playerid][pLeader] = 1;
                new tmp2[256];
                format(tmp2, sizeof(tmp2), "~w~This place owned by:~g~ %d", leader);
                GameTextForPlayer(playerid, tmp2, 5000, 1);
            }
Try it now.


Re: Leader name - Unte99 - 18.11.2011

Quote:
Originally Posted by -Luis
View Post
pawn Code:
else if (PlayerToPoint(2.0, playerid,2421.4934,-1219.2512,25.5613)) //
            {
                SetPlayerInterior(playerid,2);
                SetPlayerPos(playerid,1204.809936,-11.586799,1000.921875);
                new leader = PlayerInfo[playerid][pLeader] = 1;
                new tmp2[256];
                format(tmp2, sizeof(tmp2), "~w~This place owned by:~g~ %d", leader);
                GameTextForPlayer(playerid, tmp2, 5000, 1);
            }
Try it now.
Doesn't the script has to get the name of the leader in the format ?


Re: Leader name - Luis- - 18.11.2011

Wait, could you explain what your errors are properly.


Re: Leader name - Unte99 - 18.11.2011

pawn Code:
else if (PlayerToPoint(2.0, playerid,2421.4934,-1219.2512,25.5613)) //
            {
                new leadername[36];
                for(new i=0;i<MAX_PLAYERS;i++)
                {
                    if(PlayerInfo[i][pLeader] == 1)
                    {
                        GetPlayerName(i, leadername, sizeof(leadername));
                    }
                    SetPlayerInterior(playerid,2);
                    SetPlayerPos(playerid,1204.809936,-11.586799,1000.921875);
                    new tmp2[256];
                    format(tmp2, sizeof(tmp2), "~w~This place owned by:~g~ %s", leadername);
                    GameTextForPlayer(playerid, tmp2, 5000, 1);
                }
            }
I think he wants, that when a player enters a certain area, the player will be shown a message with the name of the area's owner. But he isn't getting the name of the leader. Surely this:

pawn Code:
PlayerInfo[playerid][pLeader] = 1
wouldn't mean the name of the leader ?


Re: Leader name - Qur - 19.11.2011

Well yea.. I want that if ANY PLAYER enter to area he gets the owner of the place.. which is faction leader..
btw.. i tried:

pawn Code:
else if (PlayerToPoint(2.0, playerid,2421.4934,-1219.2512,25.5613)) //
            {
                new leadername[36];
                for(new i=0;i<MAX_PLAYERS;i++)
                {
                    if(PlayerInfo[i][pLeader] == 1)
                    {
                        GetPlayerName(i, leadername, sizeof(leadername));
                    }
                    SetPlayerInterior(playerid,2);
                    SetPlayerPos(playerid,1204.809936,-11.586799,1000.921875);
                    new tmp2[256];
                    format(tmp2, sizeof(tmp2), "~w~This place owned by:~g~ %d", leadername);
                    GameTextForPlayer(playerid, tmp2, 5000, 1);
                }
            }
and still not working... when I enter its saying owner: 74
and i get no errors at all


Re: Leader name - Jack_Leslie - 19.11.2011

My god, are we all that dumb?

Okay, you want it to show the NAME of the FACTION LEADER,
so you need to use a database to store the faction information. Use a .ini file system or mysql for this. You can't do what you want until you do this.


Re: Leader name - Unte99 - 19.11.2011

Quote:
Originally Posted by Qur
View Post
Well yea.. I want that if ANY PLAYER enter to area he gets the owner of the place.. which is faction leader..
btw.. i tried:

pawn Code:
else if (PlayerToPoint(2.0, playerid,2421.4934,-1219.2512,25.5613)) //
            {
                new leadername[36];
                for(new i=0;i<MAX_PLAYERS;i++)
                {
                    if(PlayerInfo[i][pLeader] == 1)
                    {
                        GetPlayerName(i, leadername, sizeof(leadername));
                    }
                    SetPlayerInterior(playerid,2);
                    SetPlayerPos(playerid,1204.809936,-11.586799,1000.921875);
                    new tmp2[256];
                    format(tmp2, sizeof(tmp2), "~w~This place owned by:~g~ %d", leadername);
                    GameTextForPlayer(playerid, tmp2, 5000, 1);
                }
            }
and still not working... when I enter its saying owner: 74
and i get no errors at all
format(tmp2, sizeof(tmp2), "~w~This place owned by:~g~ %d", leadername);

d - integer, s - string. In this case your'e using a player's name, so you have to use %s.



Quote:

My god, are we all that dumb?

Okay, you want it to show the NAME of the FACTION LEADER,
so you need to use a database to store the faction information. Use a .ini file system or mysql for this. You can't do what you want until you do this.

Your'e wrong.


Re: Leader name - Qur - 19.11.2011

Thanks a lot.. I changed to d cuz someone here said.. i didnt know all this..
right now working
thank you all