[AJUDA]Comando
#9

Sу uma observaзгo.
Olhe bem pro seu cуdigo, tem vбrias funзхes que sгo exatamente iguais para os dois casos.

Ex:

pawn Код:
GivePlayerWeapon(playerid, 26, 400);        
GivePlayerWeapon(playerid, 31, 150);        
GivePlayerWeapon(playerid, 34, 400);        
GivePlayerWeapon(playerid, 28, 400);        
GivePlayerWeapon(playerid, 24, 400);        
SetPlayerHealth(playerid,100);        
SetPlayerArmour(playerid,100);        
TogglePlayerControllable(playerid,0);
Vocк pode economizar linhas deixando os cуdigos comuns fora do if e else.

Ex:

pawn Код:
#define MAX_EVENTO 10      // coloque aqui o nъmero mбximo de jogadores no evento
new Lado,EmEvento; // Essa linha e a de cima vocк coloca no topo.


if(strcmp("/irevento", cmdtext, true, 10) == 0)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
    format(file, sizeof(file), PASTA_CONTAS, aname);
    if(EventoCriado != 1)
        return SendClientMessage(playerid, 0x008000AA, "| ERRO | Nгo tem evento criado!");
    if(MAX_EVENTO == EmEvento)
        return SendClientMessage(playerid, 0x008000AA, "| INFO | O Evento ja esta lotado!");
   
    if(!Lado)
    {
        SetPlayerPos(playerid, -3554.9182,376.5091,23.3792);
        SetPlayerSkin(playerid,287);
        Lado = 1;
        noevento[playerid] = 1;
    }
    else
    {
        SetPlayerPos(playerid, -3775.4141,417.6548,22.0736); // pos da equipe B
        SetPlayerSkin(playerid,104);
        Lado = 0;
        noevento[playerid] = 1;
    }
    GivePlayerWeapon(playerid, 26, 400);
    GivePlayerWeapon(playerid, 31, 150);
    GivePlayerWeapon(playerid, 34, 400);
    GivePlayerWeapon(playerid, 28, 400);
    GivePlayerWeapon(playerid, 24, 400);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    SetPlayerSkin(playerid,104);
    TogglePlayerControllable(playerid,0);
    EmEvento++;

    return 1;
}
Reply


Messages In This Thread
[AJUDA]Comando - by lincon c - 18.08.2011, 00:33
Re: [AJUDA]Comando - by ViniBorn - 18.08.2011, 00:36
Re: [AJUDA]Comando - by lincon c - 18.08.2011, 00:42
Re: [AJUDA]Comando - by ViniBorn - 18.08.2011, 00:54
Re: [AJUDA]Comando - by lincon c - 18.08.2011, 00:59
Re: [AJUDA]Comando - by lincon c - 18.08.2011, 01:04
Re: [AJUDA]Comando - by ViniBorn - 18.08.2011, 01:06
Re: [AJUDA]Comando - by You_Tube - 18.08.2011, 02:39
Re: [AJUDA]Comando - by ViniBorn - 18.08.2011, 17:11
Respuesta: [AJUDA]Comando - by xxzim - 18.08.2011, 17:18

Forum Jump:


Users browsing this thread: 2 Guest(s)