SA-MP Forums Archive
Spawn para nomes - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: Spawn para nomes (/showthread.php?tid=268242)



Spawn para nomes - Jhoow - 11.07.2011

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


Re: Spawn para nomes - Jhoow - 11.07.2011

up, ninguйm? D:


Re: Spawn para nomes - Josma_cmd - 11.07.2011

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.


Re: Spawn para nomes - Shadoww5 - 11.07.2011

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.


Re: Spawn para nomes - RockFire - 11.07.2011

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;




Re: Spawn para nomes - CocaC0la - 11.07.2011

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;




Re: Spawn para nomes - Jhoow - 11.07.2011

Valeu ae, funcionou direitinho


Re: Spawn para nomes - Josma_cmd - 11.07.2011

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 =).


Re: Spawn para nomes - BrunoBSF - 11.07.2011

parabens pelo codigo


Re: Spawn para nomes - Miqueias Barros - 12.07.2011

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