Getting a letter and using it
#1

I'm making a system where when a player connects, that players name, specifically the first name, is retrieved. It is then used to load some shit, like that player's info. However, I dont want to have to specify EVERY letter. For example,

pawn Код:
public OnPlayerConnect(playerid)
{
  new name[MAX_PLAYER_NAME],firstletter[2];
  GetPlayerName(playerid,name,sizeof(name));
  strmid(firstletter,name,0,1,sizeof(firstletter));
  switch(firstletter[0])
  {
     case 'a', 'A', 'b', 'B': print("example")
     case 'c', 'C', 'd', 'D': print("well, yeah")
  }
  return 1;
}
Cept not have to type EVERY letter. Any help?
Reply
#2

it would make more sense if your save the ip of the players and then when a player connects if checks if the user file exists and if the 2 ips equal it logs them in automatically,
if its a autologin your making, if its not i understood wrong :[
Reply
#3

Well, people might log onto different computers to play SARP, use proxies for who knows why, etc.
Reply
#4

Superbump
Reply
#5

it wouldnt log them on though becuase it would compare the ip's first.

if your method is for a autologin it would be much less secure
Reply
#6

I'll give you a hint. A-I, J-S, R-Z, dini, player info.
Reply
#7

bumper cars
Reply
#8

It's not clear exactly what u want. Why dont you have a look at some admin scripts if you simply want to load a player's file.
Or if you wanted to get only the player's first name for other purposes then have a look at this 'split' function by Norn: http://forum.sa-mp.com/index.php?top...5947#msg505947
Reply
#9

Quote:
Originally Posted by [B2K
Hustler ]
It's not clear exactly what u want. Why dont you have a look at some admin scripts if you simply want to load a player's file.
Or if you wanted to get only the player's first name for other purposes then have a look at this 'split' function by Norn: http://forum.sa-mp.com/index.php?top...5947#msg505947
Well, thanks, but I've just solved my problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)