Posts: 154
Threads: 23
Joined: Feb 2015
Reputation:
0
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]
Posts: 579
Threads: 5
Joined: Oct 2015
PHP код:
public OnPlayerConnect(playerid)
{
new pName[MAX_PLAYER_NAME]; //Player name's variable.
GetPlayerName(playerid, pName, sizeof(pName))
if(!strcmp(pName, "John", true)) // Checking if the name matches 'John'
{
SetPlayerPos(playerid, 0, 0, 10); //Put the cords here, Just example.
}
return 1;
}
Posts: 579
Threads: 5
Joined: Oct 2015
just use '||' and repeat the same strcmp function.
example.
PHP код:
public OnPlayerConnect(playerid)
{
new pName[MAX_PLAYER_NAME]; //Player name's variable.
GetPlayerName(playerid, pName, sizeof(pName))
if(!strcmp(pName, "John", true) || !strcmp(pName, "Demi", true)) // Checking if the name matches 'John' or 'Demi'
{
SetPlayerPos(playerid, 0, 0, 10); //Put the cords here, Just example.
}
return 1;
}