OnPlayerSpawn Help! [+1 Rep]
#1

Hello!

I want you to help me on how to create when someone spawns (OnPlayerSpawn) to check his name and if his name is for example "john", i want this specific name to tp somewhere for example. Can you please show me an example code? [+1 Rep]
Reply
#2

PHP код:
public OnPlayerConnect(playerid)
{
    new 
pName[MAX_PLAYER_NAME]; //Player name's variable.
    
GetPlayerName(playeridpNamesizeof(pName))
    if(!
strcmp(pName"John"true)) // Checking if the name matches 'John'
    
{
        
SetPlayerPos(playerid0010); //Put the cords here, Just example.
    
}
    return 
1;

Reply
#3

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
PHP код:
public OnPlayerConnect(playerid)
{
    new 
pName[MAX_PLAYER_NAME]; //Player name's variable.
    
GetPlayerName(playeridpNamesizeof(pName))
    if(!
strcmp(pName"John"true)) // Checking if the name matches 'John'
    
{
        
SetPlayerPos(playerid0010); //Put the cords here, Just example.
    
}
    return 
1;

OK, thanks but how can i make multiple names to check? (sorry for disturbing..lol)
Reply
#4

just use '||' and repeat the same strcmp function.
example.
PHP код:
public OnPlayerConnect(playerid)
{
    new 
pName[MAX_PLAYER_NAME]; //Player name's variable.
    
GetPlayerName(playeridpNamesizeof(pName))
    if(!
strcmp(pName"John"true) || !strcmp(pName"Demi"true)) // Checking if the name matches 'John' or 'Demi'
    
{
        
SetPlayerPos(playerid0010); //Put the cords here, Just example.
    
}
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)