Spawn para nomes
#1

Bom, tenho um server de dm/rpg que й divido por 3 clans, que formam a forзa militar do brasil e estou querendo fazer um spawn pra cada um

Por exemplo:
Cada clan leva uma tag [FAB], [EB] e [MB]
Entгo eu queria tipo se o cara logasse com [FAB] no nick spawnasse em tal lugar e a mesma coisa com os outros, e quem nгo tem uma dessas tres tags spawnasse em outro lugar.

Seria possнvel isso? por favor me ajudem estou precisando muito, valeu
Reply
#2

up, ninguйm? D:
Reply
#3

pawn Код:
public OnPlayerSpawn(playerid)
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    if(strfind(nome, "[FAB]", true) == 0)
    {
        SetPlayerPos(playerid, X, Y, Z);
        return 1;
    }
    else if(strfind(nome, "[PM]", true) == 0)
    {
        SetPlayerPos(playerid, X, Y, Z);
        return 1;
    }
    else if(strfind(nome, "[PF]", true) == 0)
    {
        SetPlayerPos(playerid, X, Y, Z);
        return 1;
    }
    return 1;
}
Coloca as coords de onde quer que nascam no lugar de X, Y, Z.
Reply
#4

PHP код:
public OnPlayerConnect(playerid)
{
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnameMAX_PLAYER_NAME);
    if(
strfind(name"[FAB]") != -1) { SetPlayerPos(playeridXYZ);}
    else if(
strfind(name"[EB]") != -1) { SetPlayerPos(playeridXYZ); }
    else if(
strfind(name"[MB]") != -1) { SetPlayerPos(playeridXYZ); }
    return 
1;

#EDIT

Malz pelo double post ... O josma foi mais rбpido que eu

#EDIT2

Josma, seu codigo estб incorreto.

Isto encontra-se na pagina da funзгo strfind na wiki.sa-mp:

Returns The number of characters before the sub string (the sub string's start position) or -1 if it's not found.
Reply
#5

Quote:
Originally Posted by Josma_cmd
Посмотреть сообщение
pawn Код:
public OnPlayerSpawn(playerid)
{
    new nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nome, sizeof(nome));
    if(strfind(nome, "[FAB]", true) == 0)
    {
        SetPlayerPos(playerid, X, Y, Z);
        return 1;
    }
    else if(strfind(nome, "[PM]", true) == 0)
    {
        SetPlayerPos(playerid, X, Y, Z);
        return 1;
    }
    else if(strfind(nome, "[PF]", true) == 0)
    {
        SetPlayerPos(playerid, X, Y, Z);
        return 1;
    }
    return 1;
}
Coloca as coords de onde quer que nascam no lugar de X, Y, Z.
PHP код:
public OnPlayerSpawn(playerid)
{
    new 
nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnomesizeof(nome));
    if(
strfind(nome"[FAB]"true) != -1)
    {
        
SetPlayerPos(playeridXYZ);
        return 
0x01;
    }
    else if(
strfind(nome"[EB]"true) != -1)
    {
        
SetPlayerPos(playeridXYZ);
        return 
0x01;
    }
    else if(
strfind(nome"[MB]"true) != -1)
    {
        
SetPlayerPos(playeridXYZ);
        return 
0x01;
    }
    return 
0x01;

Reply
#6

PHP код:
public OnPlayerSpawn(playerid)
{
    new 
nome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnomesizeof(nome));
    if(
strfind(nome"[EB]"true) != -1) {
        
SetPlayerPos(playerid,0,0,0);
    }
    else if(
strfind(nome,"[FAB]",true) != -1) {
        
SetPlayerPos(playerid,0,0,0);
    }
    else if(
strfind(nome,"[MB]",true) != 1) {
        
SetPlayerPos(playerid,0,0,0);
    }
    return 
1;

Reply
#7

Valeu ae, funcionou direitinho
Reply
#8

O cara cria o tуpico e ninguйm posta por um ano, logo apуs o primeiro post todos tem a resposta й incrнvel =).
Reply
#9

parabens pelo codigo
Reply
#10

Quote:
Originally Posted by Josma_cmd
Посмотреть сообщение
O cara cria o tуpico e ninguйm posta por um ano, logo apуs o primeiro post todos tem a resposta й incrнvel =).
Й verdade Josma, e dб pra vкr por que nй? :S
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)