Jump to content

Mafia.

V.I.P
  • Posts

    792
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by Mafia.

  1. Comenzile de TIP ZCMD ( CMD) nu se pun la OnPlayerCommandPerformed , le pui oriunde in gamemod dar sa nu fie intr-un public/stock etc ,

     

    Un Ex :

    public OnPlayerCommandPerformed(playerid, cmdtext[], success)
    {
      if(!success)
      {
      new szString[128];
      format(szString, sizeof(szString), "{FF0000}Eroare: {FFFFFF}Comanda {C0FF00}%s {FFFFFF}Nu exista!");
      SCM(playerid, -1, szString);
      }
    }
    
    CMD:kick(playerid, params[])
    {
      new UserID, motiv[128];
      if(!IsPlayerAdmin(playerid))return SCM(playerid, -1, "Eroare! Nu esti admin!");
      if(!IsPlayerConnected(UserID)return SCM(playerid, -1, "Eroare! Player-ul nu este conectat!");
      if(sscanf(params, "us[128]", UserID, motiv))return SCM(playerid, -1, "Foloseste /kick [ userid ] [ motiv]");
      Kick(UserID);
      return 1;
    }
    
  2. Poftim aici :

    CMD:leaders( playerid, params [ ] )
    {
    	new szString[ 1200 ];
    	format( szString, sizeof( szString ), "{FFFFFF}LSPD - Lider: %s (%s) - Membri: %d/10n", GetFactionLeader( 1 ), IsOnline( GetFactionLeader( 1 ) ), GetFactionMembers( 1 ) );
             //// ETC
    	ShowPlayerDialog( playerid, 3434, DIALOG_STYLE_MSGBOX, "Lista Factiunilor", szString, "Ok", "" );
    	return 1;
    }
    stock IsOnline( szName[ ] )
    {
    	new szState[ 40 ];
        if( IsPlayerConnected( ReturnUserEx( szName ) ) )
    	{
    		format( szState, 40, "{C0FF00}Online{FFFFFF}" );
    	}
    	else format( szState, 40, "{FF0000}Offline{FFFFFF}" );
    	return szState;
    }
    
    stock GetFactionLeader( FactionID )
    {
    	new szString[ 128 ], Cache: Result, Get[ 2 ], szLeaderName[ MAX_PLAYER_NAME ];
    	format( szString, sizeof( szString ), "SELECT `Name` FROM `users` WHERE `Leader` = %d LIMIT 1;", FactionID );// Aici modifici tu cum ai in baza de date !!
        Result = mysql_query( SQL, szString );
        cache_get_data( Get[ 0 ], Get[ 1 ], SQL );
        if( !Get[ 0 ] ) szLeaderName = "NO-ONE";
       	 else cache_get_field_content( 0, "Name", szLeaderName, SQL, sizeof( szLeaderName ) );
        cache_delete( Result );
    	return ( szLeaderName );
    }
    
    stock GetFactionMembers( FactionID )
    {
    	new szString[ 128 ], Cache: Result, Get[ 2 ];
    	format( szString, sizeof( szString ), "SELECT `Member` FROM `users` WHERE `Member` = %d", FactionID );// Aici modifici tu cum ai in baza de date !!
        Result = mysql_query( SQL, szString );
        cache_get_data( Get[ 0 ], Get[ 1 ], SQL );
        cache_delete( Result );
    	return Get[ 0 ];
    }
    
  3. if(IsPlayerConnected( szName ) )

    , incearca asa.

    Incearca asa

    if( IsPlayerConnected( ReturnUserEx( szName ) ) )
    

    Am pus cum e tutorial stock si imi da urm eroare

    C:UsersJorjDesktopsaints v1.3gamemodessaints.pwn(2726) : warning 217: loose indentation

    C:UsersJorjDesktopsaints v1.3gamemodessaints.pwn(2726) : error 017: undefined symbol "ReturnUserEx"

    C:UsersJorjDesktopsaints v1.3gamemodessaints.pwn(2731) : warning 217: loose indentation

    C:UsersJorjDesktopsaints v1.3gamemodessaints.pwn(12491) : warning 217: loose indentation

    C:UsersJorjDesktopsaints v1.3gamemodessaints.pwn(12485) : warning 204: symbol is assigned a value that is never used: "string3"

    Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase

    1 Error.

     

    Adaugi asta la sfarsitul GM

    ReturnUserEx(text[], playerid = INVALID_PLAYER_ID)
    {
        new pos = 0;
        while (text[pos] < 0x21)
        {
            if (text[pos] == 0) return INVALID_PLAYER_ID;
            pos++;
        }
        new userid = INVALID_PLAYER_ID;
        if (IsNumeric(text[pos]))
        {
            
            userid = strval(text[pos]);
            if (userid >=0 && userid < MAX_PLAYERS)
            {
                if(!IsPlayerConnected(userid))
                {
                    userid = INVALID_PLAYER_ID;
                }
                else
                {
                    return userid;
                }
            }
        }
        new len = strlen(text[pos]);
        new count = 0;
        new name[MAX_PLAYER_NAME];
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if (strcmp(GetName( i ), text[pos], true, len) == 0)
                {
                    if (len == strlen(name))
                    {
                        return i;
                    }
                    else
                    {
                        count++;
                        userid = i;
                    }
                }
            }
        }
        if (count != 1)
        {
            if (playerid != INVALID_PLAYER_ID)
            {
                if (count)
                {
                    SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
                }
                else
                {
                    SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
                }
            }
            userid = INVALID_PLAYER_ID;
        }
        return userid;
    } 

    si asta la fel tot la sfarsit :

    IsNumeric(const string[])
    {
            for (new i = 0, j = strlen(string); i < j; i++)
            {
                    if (string > '9' || string < '0') return 0;
            }
            return 1;
    }

     

  4. Problema intalnita (descriere): Am creat niste obiecte (stalpi si banci) si vrea sa le fac cu viata infinita(sa nu se distruga cand targi in ele)Si nu stiu cum!

    Ero(area / rile) / warning-(ul / urile): -

    Liniile de cod / sursa / script-ul(obligatoriu):     CreateObject(1231,767.7999900,-1164.7000000,24.3000000,0.0000000,0.0000000,294.0000000);

    Imagini / Video (optional):

    Ati incercat sa rezolvati singur?: Da

    ceea ce spui tu nu se poate..

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.