Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 KB | None | 0 0
  1. CMD:makeleader( playerid, const params[] )
  2. {
  3. if( PlayerInfo[ playerid ][ xAdmin ] >= 4 || PlayerInfo[ playerid ][ xSkriptaRank ] == 4 )
  4. {
  5. if( PlayerInfo[ playerid ][ xAdmin ] <= 5 && !AdminDuty[ playerid ] ) return SendErrorMessage( playerid, "Da bi koristili ovu komandu morate biti Admin na duznosti." );
  6. new id, kolicina;
  7. if( sscanf( params, "ui", id, kolicina ) )
  8. {
  9. SendUsageMessage( playerid, "/makeleader [id] [org]" );
  10. SendClientMessage( playerid, -1, "Listu organizacija gledate komandom [ /server > Spisak organizacija ] ili [ /organizacije ]." );
  11. return(true);
  12. }
  13.  
  14. if( id == IPI ) return SendErrorMessage( playerid, "Taj igrac nije na serveru.");
  15. if( kolicina == 0 )
  16. {
  17. if( PlayerInfo[ id ][ xLider ] == 0 ) return SendErrorMessage( playerid, "Taj igrac nije lider nijedne organizacije" );
  18. new OrgID = PlayerInfo[ id ][ xLider ];
  19.  
  20. for( new i = 0; i < 51; i++ )
  21. {
  22. if( strcmp( ImeIgraca( id ), org_members_info[ OrgID ][ i ][ o_m_Name ], true ) == 0 )
  23. {
  24. strmid( org_members_info[ OrgID ][ i ][ o_m_Name ], "Niko", 0, strlen( "Niko" ), MAX_PLAYER_NAME );
  25. org_members_info[ OrgID ][ i ][ o_m_sqlID ] = 0; //PlayerInfo[ playerid ][ xID ]
  26. org_members_info[ OrgID ][ i ][ o_m_type ] = 0;
  27. break;
  28. }
  29. }
  30.  
  31. sql_org_member_delete( org_info[ OrgID ][ oID ], PlayerInfo[ id ][ xID ] );
  32.  
  33. PlayerInfo[ id ][ xLider ] = 0;
  34. PlayerInfo[ id ][ xRank ] = 0;
  35. PlayerInfo[ id ][ xClan ] = 0;
  36. PlayerInfo[ id ][ xOrgUgovor ] = 0;
  37. PlayerInfo[ id ][ xSkin ] = SetSexSkin( id );
  38. PlayerInfo[ id ][ xSpawn ] = SetRandomSpawn( id );
  39. v_SetPlayerSkin( id, SetSexSkin( id ) );
  40. sql_user_update_org_variables( id );
  41. SCMF( id, 0x33CCFFFF, "#LIDER: {FFFFFF}%s {33CCFF}%s {FFFFFF}vam je skinuo lidera.", getAdminRankName( playerid ), ImeIgraca( playerid ) );
  42.  
  43. format( globalstring, sizeof( globalstring ), "[ADMIN] %s je skinuo lidera igracu %s.", ImeIgraca( playerid ), ImeIgraca( id ) );
  44. AdminPoruka( ADM_WARN, globalstring );
  45. }
  46. else
  47. {
  48. if( PlayerInfo[ id ][ xClan ] != 0 ) return SendErrorMessage( playerid, "Taj igrac je vec clan neke organizacije" );
  49. if( PlayerInfo[ id ][ xLider ] != 0 ) return SendErrorMessage( playerid, "Taj igrac je vec clan neke organizacije" );
  50. if( kolicina < 1 || org_info[ kolicina ][ oID ] == 0 ) return SendErrorMessage( playerid, "Ta organizacija ne postoji u bazi podataka." );
  51.  
  52. if( org_info[ kolicina ][ oSuspended ] ) return SendErrorMessage( playerid, "Ova organizacija je zakljucana od strane vlasnika." );
  53.  
  54. new c_l = 0;
  55. for( new i = 0; i < 51; i++ )
  56. {
  57. if( org_members_info[ kolicina ][ i ][ o_m_type ] == 1 ) c_l++;
  58. }
  59. if( c_l >= 2 ) SendErrorMessage( playerid, "Ova organizacija vec ima dva lidera." );
  60.  
  61. new slot_id = -1;
  62. for( new i = 0; i < 51; i++ )
  63. {
  64. if( strcmp( "Niko", org_members_info[ kolicina ][ i ][ o_m_Name ], true ) == 0 )
  65. {
  66. slot_id = i;
  67. break;
  68. }
  69. }
  70. if( slot_id == -1 ) return SendErrorMessage( playerid, "Ova organizacija vec ima dva lidera." );
  71.  
  72. strmid( org_members_info[ kolicina ][ slot_id ][ o_m_Name ], ImeIgraca( id ), 1, strlen( ImeIgraca( id ) ), MAX_PLAYER_NAME );
  73. org_members_info[ kolicina ][ slot_id ][ o_m_sqlID ] = PlayerInfo[ id ][ xID ];
  74. org_members_info[ kolicina ][ slot_id ][ o_m_type ] = 1;
  75.  
  76. PlayerInfo[ id ][ xLider ] = kolicina;
  77. PlayerInfo[ id ][ xClan ] = kolicina;
  78. PlayerInfo[ id ][ xOrgUgovor ] = 0;
  79. PlayerInfo[ id ][ xSpawn ] = SPAWN_BAZA;
  80. PlayerInfo[ id ][ xRank ] = 6;
  81.  
  82.  
  83. if( PlayerInfo[ id ][ xPol ] == 1 ) PlayerInfo[ id ][ xSkin ] = org_info[ kolicina ][ oSkin6 ], v_SetPlayerSkin( id, org_info[ kolicina ][ oSkin6 ] );
  84. else if( PlayerInfo[ id ][ xPol ] == 2 ) PlayerInfo[ id ][ xSkin ] = org_info[ kolicina ][ oZSkin6 ], v_SetPlayerSkin( id, org_info[ kolicina ][ oZSkin6 ] );
  85.  
  86. sql_org_member_inser( org_info[ kolicina ][ oID ], 0, id );
  87. sql_user_update_org_variables( id );
  88. SCMF( id, 0x33CCFFFF, "#LIDER: {FFFFFF}%s {33CCFF}%s {FFFFFF}vam je postavio poziciju lidera {33CCFF}%s.", getAdminRankName( playerid ), ImeIgraca( playerid ), org_info[ kolicina ][ oName ] );
  89. format( globalstring, sizeof( globalstring ), "[ADMIN] %s je postavio poziciju lidera %s igracu %s.", ImeIgraca( playerid ), org_info[ kolicina ][ oName ], ImeIgraca( id ) );
  90. AdminPoruka( ADM_WARN, globalstring );
  91. }
  92. }
  93. else return SendErrorMessage( playerid, "Niste u mogucnosti koristiti ovu komandu.");
  94. return(true);
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement