[SOLVED] Add player/clan [tag] when player chooses class?
#1

I downloaded an automatic gates script, http://forum.sa-mp.com/index.php?topic=73014.0 t-auto gates...
anyway...
you can add a player tag to the line so that the gate opens only for players with that tag, so i want to have something that can add a [tag] to the beginning of a players name when the player chooses a class.
different classes would have different clan tags...

Eg:
before:
Fishnutslol
after:
[LOL]Fishnutslol

is there any way i could do this?
i have looked around the place (wiki, forum, ******) and not found anything.

Код:
	AddAutoGate(980,-1039.116,-588.074,33.786,0.0,0.0,0.0,-1028.566,-588.074,33.786,"tag goes here!!!",5);
My server is still under construction...
Im building a prison camp-ish place, and you have to escape... or get killed. All while the guards are having a war with the people who want to help the people in the camps...

any help/suggestions are welcome atm... lol
Reply
#2

Giving player the tag...

pawn Код:
stock GivePlayerTag ( playerid , tag [ ] )
{
  new name [ MAX_PLAYER_NAME ];
  new newname [ 30 ];

  GetPlayerName ( playerid , name , MAX_PLAYER_NAME );

  format ( newname , sizeof ( newname ) , "[%s]%s" , tag , name );

  SetPlayerName ( playerid , string );

  return 1;
}
Untested. Please let me know if it doesnt work.

Usage:

pawn Код:
GivePlayerTag ( playerid , "LOL" );
if the players name is Cake that would turn the players name into [LOL]Cake.

I once made a GetPlayerTag function and ill see if i can find it for you.
Reply
#3

kewl!!!
ima test it now.
thank you!
Reply
#4

hey one question... where do i put the
Quote:
Originally Posted by WrathOfGenesis
pawn Код:
GivePlayerTag ( playerid , "LOL" );
bit...
Reply
#5

my friend helped fix an error with the code, instead of the "string" put "newname"
Код:
stock GivePlayerTag ( playerid , tag [ ] )
{
  new name [ MAX_PLAYER_NAME ];
  new newname [ 30 ];

  GetPlayerName ( playerid , name , MAX_PLAYER_NAME );

  format ( newname , sizeof ( newname ) , "[%s]%s" , tag , name );

  SetPlayerName ( playerid , newname );

  return 1;
}
public OnPlayerSpawn(playerid)
{
  // First we need to see what classid a player got
  switch(gClass[playerid])
  {
    case 0,1,2,3,4,5,6,7,8,9,10:
    {
      SetPlayerColor(playerid, 0xFF6600AA); // Orange
      GivePlayerTag ( playerid , "ONE" );
    }
    case 11,12,13,14,15,16,17,18,19,20,21,22:
    {
      SetPlayerColor(playerid, 0xFF0000AA); // Red
    	GivePlayerTag ( playerid , "TWO" );
    }
    case 23,24,25,26,27,28,29,30,31:
    {
      SetPlayerColor(playerid, 0x0066FFAA); // blue
      GivePlayerTag ( playerid , "THREE" );
    }
  }
  return 1;
}
Thats how i put it and it works perfect!!!!!!!!
THANK YOU!
Reply
#6

i need an GetPlayerTag function... So Example ( i know how to script the command e.t.c. just give me the getplayertag function)

he types : /tdbcenter

if he has [TdB] on his nick answer : Welcome Admin! ( i can make this for others clans... moast popular clans on my server )

if he has not [TdB] on his nick Answer ( Code )

Код:
SendClientMessage(playerid,red,"Piss Off!");
Kick(playerid);
Reply
#7

nice !
Reply
#8

nice and it works..
well how i can save the player name during registrasion phase
after player choose the character without the tag
(the real nickname on player samp client software)
e.g.
(on the client software) crew (the nickname is not registered so it will need register after select a character)
then i choose chara fam1 and spawn, then i press tab and see my nickname change to [GSF]crew
after spawn apprears dialog that i must register because the nickname is not registered
i see on dialog 'nickname [GSF]crew not registered, please register', i think it will save the player data with nickname [GSF]crew
on the scipt i add a clan system that allow player to join/leave a clan, and if the player change clan to ballas with tag [LSB] it need register again..
so how i can fix it..??
can you help me...

thanks before and sorry for the english
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)