SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 18/11/2011, 11:01 PM   #1
Qur
Huge Clucker
 
Join Date: Oct 2007
Posts: 267
Reputation: 0
Default Leader name

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..
Qur is offline   Reply With Quote
Old 18/11/2011, 11:08 PM   #2
Luis-
High-roller
 
Luis-'s Avatar
 
Join Date: Jan 2010
Location: England
Posts: 3,933
Reputation: 420
Default Re: Leader name

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.
__________________
Luis- is offline   Reply With Quote
Old 18/11/2011, 11:11 PM   #3
Unte99
Gangsta
 
Unte99's Avatar
 
Join Date: Jul 2010
Location: Lithuania
Posts: 627
Reputation: 67
Default Re: Leader name

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 ?
Unte99 is offline   Reply With Quote
Old 18/11/2011, 11:12 PM   #4
Luis-
High-roller
 
Luis-'s Avatar
 
Join Date: Jan 2010
Location: England
Posts: 3,933
Reputation: 420
Default Re: Leader name

Wait, could you explain what your errors are properly.
__________________
Luis- is offline   Reply With Quote
Old 18/11/2011, 11:28 PM   #5
Unte99
Gangsta
 
Unte99's Avatar
 
Join Date: Jul 2010
Location: Lithuania
Posts: 627
Reputation: 67
Default Re: Leader name

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 ?
Unte99 is offline   Reply With Quote
Old 19/11/2011, 07:30 AM   #6
Qur
Huge Clucker
 
Join Date: Oct 2007
Posts: 267
Reputation: 0
Default Re: Leader name

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
Qur is offline   Reply With Quote
Old 19/11/2011, 07:35 AM   #7
Jack_Leslie
High-roller
 
Jack_Leslie's Avatar
 
Join Date: Feb 2011
Location: Australia
Posts: 1,197
Reputation: 98
Default Re: Leader name

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.
__________________
lol
Jack_Leslie is offline   Reply With Quote
Old 19/11/2011, 07:37 AM   #8
Unte99
Gangsta
 
Unte99's Avatar
 
Join Date: Jul 2010
Location: Lithuania
Posts: 627
Reputation: 67
Default Re: Leader name

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.
Unte99 is offline   Reply With Quote
Old 19/11/2011, 08:04 AM   #9
Qur
Huge Clucker
 
Join Date: Oct 2007
Posts: 267
Reputation: 0
Default Re: Leader name

Thanks a lot.. I changed to d cuz someone here said.. i didnt know all this..
right now working
thank you all
Qur is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
member becomes a leader? Nemanja92 Help Archive 11 28/12/2010 10:43 PM
Textdraw leader jaksimaksi Help Archive 3 30/08/2010 12:58 PM
Problem with PD leader billy_thekid Client Support 2 17/05/2009 03:19 PM
Leader help JoeDaDude Help Archive 1 10/05/2009 12:58 PM


All times are GMT. The time now is 12:01 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.