Advertisement
Luciano_fuentes

Untitled

May 8th, 2017
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. Public Sub ChangePorcUser(ByVal Slot As Byte, ByRef Members() As Byte, ByRef Porc() As Byte)
  2. ' Lleno los datos:
  3.  
  4. 'Slot = 1
  5. 'Members(1) = 1
  6. 'Members(2) = 0
  7. 'Members(3) = 2
  8. 'Members(4) = 0
  9. 'Members(5) = 3
  10. 'Porc(1) = 50
  11. 'Porc(2) = 0
  12. 'Porc(3) = 40
  13. 'Porc(4) = 0
  14. 'Porc(5) = 200
  15.  
  16. Dim PorcTotal As Long
  17.  
  18. 100 For i = 1 To MAX_MEMBERS
  19. 101 If Members(i) <> 0 Then
  20. 102 If Porc(i) > 100 Or Porc(i) < MIN_PORC Then
  21. 103 WriteConsoleMsg Members(i), "ยซ " & UserList(Members(i)).Name & " ยป . SACA LA MANO DE AHI CARAJO!!!", FontTypeNames.FONTTYPE_WARNING
  22. 104 Exit Sub
  23. 105 End If
  24.  
  25. 106 If Members(i) <> 0 Then
  26. 107 Data(Slot).Members(i).Porc = Porc(i)
  27. 108 PorcTotal = PorcTotal + Porc(i)
  28. 109 End If
  29.  
  30. 110 If PorcTotal <> 100 Then Exit For: Exit Sub
  31.  
  32. 111 End If
  33. 112 Next i
  34. 113End Sub
  35.  
  36.  
  37. PRIMERA VUELTA:
  38.  
  39. 101: Se cumple el condicional porque Members(i) vale 1.
  40. 102: No cumple el condicional porque Porc(i) vale 50, salta a 106.
  41. 106: Cumple el condicional de la 101 de nuevo.
  42. 107: La variable .Porc obtiene el valor de Porc(i) que es 50.
  43. 108: La variable PorcTotal obtiene el valor de Porc(i) que es 50.
  44. 110: El condicional se cumple porque PorcTotal es diferente a 100, sale del bucle y salto a 113.
  45. 113: Chau.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement